mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Fix Tier installer NullPointerException onItemUse
This commit is contained in:
1 parent
824ef96e54
commit
799874f015
2 files changed
+9
-3
No files matched your search
@@ -101,10 +101,14 @@ public interface IFactory {
|
||||
}
|
||||
|
||||
public static RecipeType getFromMachine(Block block, int meta) {
|
||||
//Mekanism.logger.debug("Param block: " + block + " || meta:" + meta);
|
||||
RecipeType type = null;
|
||||
for (RecipeType iterType : RecipeType.values()) {
|
||||
ItemStack machineStack = iterType.getStack();
|
||||
if (Block.getBlockFromItem(machineStack.getItem()) == block && machineStack.getItemDamage() == meta) {
|
||||
Block machineBlock = Block.getBlockFromItem(machineStack.getItem());
|
||||
int machineMeta = machineStack.getItemDamage();
|
||||
// Mekanism.logger.debug("Search block: " + machineBlock + " || meta:" + machineMeta);
|
||||
if (machineBlock == block && machineMeta == meta) {
|
||||
type = iterType;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,12 +33,14 @@ public abstract class TileEntityUpgradeableMachine<INPUT extends MachineInput<IN
|
||||
if (upgradeTier != BaseTier.BASIC) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RecipeType type = RecipeType.getFromMachine(getBlockType(), getBlockMetadata());
|
||||
|
||||
world.setBlockToAir(getPos());
|
||||
world.setBlockState(getPos(), MekanismBlocks.MachineBlock.getStateFromMeta(5), 3);
|
||||
|
||||
TileEntityFactory factory = Objects.requireNonNull((TileEntityFactory) world.getTileEntity(getPos()));
|
||||
RecipeType type = RecipeType.getFromMachine(getBlockType(), getBlockMetadata());
|
||||
|
||||
|
||||
//Basic
|
||||
factory.facing = facing;
|
||||
factory.clientFacing = clientFacing;
|
||||
|
||||
Reference in new issue
Block a user