diff --git a/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java b/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java index 5eca2c8..b097d67 100644 --- a/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java +++ b/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java @@ -5,7 +5,9 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -50,6 +52,9 @@ public class ItemBarrelMover extends Item { protected static ArrayList classExtensionsNames = new ArrayList(); protected static HashMap classMap = new HashMap(); + protected static ArrayList spawnerClassExtensionsNames = new ArrayList(); + protected static Set> spawnerClasses = new HashSet<>(); + protected Method tagCompoundWrite = Utils.ReflectionHelper.getMethod( NBTTagCompound.class, new String[] { "a", "func_74734_a", "write" }, @@ -121,6 +126,15 @@ protected enum DollyType { classExtensions.add(null); } } + + spawnerClassExtensionsNames.add("chylex.hee.tileentity.TileEntityCustomSpawner"); + spawnerClasses.add(TileEntityMobSpawner.class); + + for (String s : spawnerClassExtensionsNames) { + try { + spawnerClasses.add(Class.forName(s)); + } catch (ClassNotFoundException ignored) {} + } } public ItemBarrelMover() { @@ -536,16 +550,11 @@ private boolean isTEMovable(TileEntity te) { } private static boolean tileIsASpawner(TileEntity te) { - if (te instanceof TileEntityMobSpawner) { - return true; - } - - try { - Class heeClass = Class.forName("chylex.hee.tileentity.TileEntityCustomSpawner"); - if (heeClass.isInstance(te)) { + for (Class c : spawnerClasses) { + if (c != null && c.isInstance(te)) { return true; } - } catch (ClassNotFoundException ignored) {} + } return false; }