From 77ae00f768cbb50a0f94580f1ea2237ea2b59f84 Mon Sep 17 00:00:00 2001 From: Matthias Mann Date: Sat, 14 Feb 2015 08:39:38 +0100 Subject: [PATCH] #1886 remember smelting mode when wrenching the Alloy Smelter --- .../enderio/machine/alloy/TileAlloySmelter.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/alloy/TileAlloySmelter.java b/src/main/java/crazypants/enderio/machine/alloy/TileAlloySmelter.java index 131fdf16..e1dbdc4b 100644 --- a/src/main/java/crazypants/enderio/machine/alloy/TileAlloySmelter.java +++ b/src/main/java/crazypants/enderio/machine/alloy/TileAlloySmelter.java @@ -12,7 +12,6 @@ import crazypants.enderio.machine.IMachineRecipe.ResultStack; import crazypants.enderio.machine.MachineRecipeInput; import crazypants.enderio.machine.MachineRecipeRegistry; import crazypants.enderio.machine.SlotDefinition; -import crazypants.enderio.machine.generator.stirling.TileEntityStirlingGenerator; import crazypants.enderio.machine.recipe.ManyToOneMachineRecipe; public class TileAlloySmelter extends AbstractPoweredTaskEntity { @@ -186,15 +185,19 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity { } @Override - public void readCustomNBT(NBTTagCompound nbtRoot) { - super.readCustomNBT(nbtRoot); + public void readCommon(NBTTagCompound nbtRoot) { + super.readCommon(nbtRoot); short mb = nbtRoot.getShort("mode"); - mode = Mode.values()[mb]; + Mode[] modes = Mode.values(); + if(mb < 0 || mb >= modes.length) { + mb = 0; + } + mode = modes[mb]; } @Override - public void writeCustomNBT(NBTTagCompound nbtRoot) { - super.writeCustomNBT(nbtRoot); + public void writeCommon(NBTTagCompound nbtRoot) { + super.writeCommon(nbtRoot); nbtRoot.setShort("mode", (short) mode.ordinal()); }