Merge pull request 'fix: more checks on ThemedEntity Class (Always more to fix)' (#21) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m8s
All checks were successful
deploy / deploy (push) Successful in 5m8s
Reviewed-on: #21
This commit is contained in:
commit
73bf27bdda
@ -9,7 +9,7 @@ loader_version=0.15.11
|
||||
|
||||
# Mod Properties
|
||||
modrinth_id = jCpoCBpn
|
||||
mod_version = 1.6.2
|
||||
mod_version = 1.6.3
|
||||
maven_group = fr.adrien1106
|
||||
archives_base_name = ReFramed
|
||||
mod_id = reframed
|
||||
|
@ -2,6 +2,7 @@ package fr.adrien1106.reframed.util.mixin;
|
||||
|
||||
import fr.adrien1106.reframed.util.blocks.ThemeableBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtHelper;
|
||||
@ -29,11 +30,16 @@ public class ThemedBlockEntity extends BlockEntity implements ThemeableBlockEnti
|
||||
|
||||
@Override
|
||||
public BlockState getTheme(int i) {
|
||||
if (i > themes.size())
|
||||
return Blocks.AIR.getDefaultState();
|
||||
return themes.get(Math.max(0, i-1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTheme(BlockState state, int i) {
|
||||
if (i > themes.size())
|
||||
themes.add(state);
|
||||
else
|
||||
themes.set(Math.max(0, i-1), state);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user