Fix crash when SchematicannonTileEntity try to parse state using empty string

This commit is contained in:
EdrowsLuo 2023-02-21 14:59:46 +08:00
parent 40f96b0038
commit 3ed3fe5a09

View file

@ -155,7 +155,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
schematicProgress = compound.getFloat("Progress"); schematicProgress = compound.getFloat("Progress");
bookPrintingProgress = compound.getFloat("PaperProgress"); bookPrintingProgress = compound.getFloat("PaperProgress");
fuelLevel = compound.getFloat("Fuel"); fuelLevel = compound.getFloat("Fuel");
state = State.valueOf(compound.getString("State")); String stateString = compound.getString("State");
state = stateString.isEmpty() ? State.STOPPED : State.valueOf(compound.getString("State"));
blocksPlaced = compound.getInt("AmountPlaced"); blocksPlaced = compound.getInt("AmountPlaced");
blocksToPlace = compound.getInt("AmountToPlace"); blocksToPlace = compound.getInt("AmountToPlace");