diff --git a/src/main/java/mekanism/common/block/states/BlockStateBasic.java b/src/main/java/mekanism/common/block/states/BlockStateBasic.java index 6f85904d4..6e961ae2d 100644 --- a/src/main/java/mekanism/common/block/states/BlockStateBasic.java +++ b/src/main/java/mekanism/common/block/states/BlockStateBasic.java @@ -40,6 +40,8 @@ import net.minecraftforge.common.property.IUnlistedProperty; import com.google.common.base.Predicate; import com.google.common.base.Predicates; +import javax.annotation.Nullable; + public class BlockStateBasic extends ExtendedBlockState { public static final PropertyBool activeProperty = PropertyBool.create("active"); @@ -134,6 +136,7 @@ public class BlockStateBasic extends ExtendedBlockState isBeaconBase = beaconBase; } + @Nullable public static BasicBlockType get(IBlockState state) { if(state.getBlock() instanceof BlockBasic) @@ -144,11 +147,13 @@ public class BlockStateBasic extends ExtendedBlockState return null; } + @Nullable public static BasicBlockType get(ItemStack stack) { return get(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); } + @Nullable public static BasicBlockType get(Block block, int meta) { if(block instanceof BlockBasic) @@ -159,6 +164,7 @@ public class BlockStateBasic extends ExtendedBlockState return null; } + @Nullable public static BasicBlockType get(BasicBlock blockType, int metadata) { BasicBlockType firstTry = values()[blockType.ordinal() << 4 | metadata]; diff --git a/src/main/java/mekanism/common/item/ItemBlockBasic.java b/src/main/java/mekanism/common/item/ItemBlockBasic.java index 801ea7549..85c270bfb 100644 --- a/src/main/java/mekanism/common/item/ItemBlockBasic.java +++ b/src/main/java/mekanism/common/item/ItemBlockBasic.java @@ -145,7 +145,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt { BasicBlockType type = BasicBlockType.get(itemstack); - if(type.hasDescription) + if(type != null && type.hasDescription) { if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey)) { @@ -290,7 +290,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt if(type != null) { - String name = getUnlocalizedName() + "." + BasicBlockType.get(itemstack).name; + String name = getUnlocalizedName() + "." + type.name; if(type == BasicBlockType.BIN || type == BasicBlockType.INDUCTION_CELL || type == BasicBlockType.INDUCTION_PROVIDER) {