diff --git a/src/main/java/forestry/apiculture/gui/ContainerImprinter.java b/src/main/java/forestry/apiculture/gui/ContainerImprinter.java index e35bdfa26..d1cc81281 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerImprinter.java +++ b/src/main/java/forestry/apiculture/gui/ContainerImprinter.java @@ -13,24 +13,19 @@ package forestry.apiculture.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; import forestry.apiculture.items.ItemImprinter.ImprinterInventory; -import forestry.apiculture.network.PacketImprintSelectionRequest; import forestry.apiculture.network.PacketImprintSelectionResponse; import forestry.core.gui.ContainerItemInventory; import forestry.core.gui.IGuiSelectable; import forestry.core.gui.slots.SlotFiltered; import forestry.core.gui.slots.SlotOutput; -import forestry.core.network.IForestryPacketServer; import forestry.core.network.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; +import forestry.core.utils.InventoryUtil; public class ContainerImprinter extends ContainerItemInventory implements IGuiSelectable { - private boolean isNetSynced = false; - public ContainerImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) { super(inventory, inventoryplayer, 8, 103); @@ -42,62 +37,29 @@ public class ContainerImprinter extends ContainerItemInventory= PacketIdClient.VALUES.length) { - return; - } PacketIdServer packetId = PacketIdServer.VALUES[packetIdOrdinal]; IForestryPacketServer packetHandler = packetId.getPacketHandler(); packetHandler.readData(data); @@ -61,9 +58,6 @@ public class PacketHandler { try { byte packetIdOrdinal = data.readByte(); - if (packetIdOrdinal >= PacketIdClient.VALUES.length) { - return; - } PacketIdClient packetId = PacketIdClient.VALUES[packetIdOrdinal]; IForestryPacketClient packetHandler = packetId.getPacketHandler(); packetHandler.readData(data); diff --git a/src/main/java/forestry/core/network/PacketIdServer.java b/src/main/java/forestry/core/network/PacketIdServer.java index 7c4c43c17..a053fde0a 100644 --- a/src/main/java/forestry/core/network/PacketIdServer.java +++ b/src/main/java/forestry/core/network/PacketIdServer.java @@ -22,9 +22,6 @@ public enum PacketIdServer implements IPacketId { CHIPSET_CLICK(new PacketChipsetClick()), SOLDERING_IRON_CLICK(new PacketSolderingIronClick()), - // Apiculture - IMPRINT_SELECTION_REQUEST, - // Factory WORKTABLE_NEI_SELECT, diff --git a/src/main/java/forestry/core/utils/InventoryUtil.java b/src/main/java/forestry/core/utils/InventoryUtil.java index 69d292ff2..0f4a5584b 100644 --- a/src/main/java/forestry/core/utils/InventoryUtil.java +++ b/src/main/java/forestry/core/utils/InventoryUtil.java @@ -626,7 +626,7 @@ public abstract class InventoryUtil { } } - public static void dropInventory(IInventory inventory, World world, int x, int y, int z) { + public static void dropInventory(IInventory inventory, World world, double x, double y, double z) { if (inventory == null) { return; } @@ -639,7 +639,7 @@ public abstract class InventoryUtil { } } - public static void dropSockets(ISocketable socketable, World world, int x, int y, int z) { + public static void dropSockets(ISocketable socketable, World world, double x, double y, double z) { for (int slot = 0; slot < socketable.getSocketCount(); slot++) { ItemStack itemstack = socketable.getSocket(slot); dropItemStackFromInventory(itemstack, world, x, y, z); @@ -647,7 +647,7 @@ public abstract class InventoryUtil { } } - public static void dropItemStackFromInventory(ItemStack itemStack, World world, int x, int y, int z) { + public static void dropItemStackFromInventory(ItemStack itemStack, World world, double x, double y, double z) { if (itemStack == null) { return; } diff --git a/src/main/java/forestry/food/gui/ContainerInfuser.java b/src/main/java/forestry/food/gui/ContainerInfuser.java index d7d7e4a60..8f35d2de3 100755 --- a/src/main/java/forestry/food/gui/ContainerInfuser.java +++ b/src/main/java/forestry/food/gui/ContainerInfuser.java @@ -12,12 +12,11 @@ package forestry.food.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; import forestry.core.gui.ContainerItemInventory; import forestry.core.gui.slots.SlotFiltered; import forestry.core.gui.slots.SlotOutput; -import forestry.core.proxy.Proxies; +import forestry.core.utils.InventoryUtil; import forestry.food.items.ItemInfuser.InfuserInventory; public class ContainerInfuser extends ContainerItemInventory { @@ -40,20 +39,10 @@ public class ContainerInfuser extends ContainerItemInventory { @Override public void onContainerClosed(EntityPlayer entityplayer) { - if (entityplayer.worldObj.isRemote) { return; } - // Drop everything still in there. - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack stack = inventory.getStackInSlot(i); - if (stack == null) { - continue; - } - - Proxies.common.dropItemPlayer(entityplayer, stack); - inventory.setInventorySlotContents(i, null); - } + InventoryUtil.dropInventory(inventory, entityplayer.worldObj, entityplayer.posX, entityplayer.posY, entityplayer.posZ); } } diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index 5486e352a..8f398ca3d 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -120,7 +120,6 @@ import forestry.apiculture.network.PacketActiveUpdate; import forestry.apiculture.network.PacketBeekeepingLogicActive; import forestry.apiculture.network.PacketCandleUpdate; import forestry.apiculture.network.PacketHabitatBiomePointer; -import forestry.apiculture.network.PacketImprintSelectionRequest; import forestry.apiculture.network.PacketImprintSelectionResponse; import forestry.apiculture.proxy.ProxyApiculture; import forestry.apiculture.tiles.TileApiaristChest; @@ -150,7 +149,6 @@ import forestry.core.items.ItemOverlay; import forestry.core.items.ItemOverlay.OverlayInfo; import forestry.core.items.ItemScoop; import forestry.core.network.PacketIdClient; -import forestry.core.network.PacketIdServer; import forestry.core.proxy.Proxies; import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.tiles.MachineDefinition; @@ -501,8 +499,6 @@ public class PluginApiculture extends ForestryPlugin { @Override public void registerPacketHandlers() { - PacketIdServer.IMPRINT_SELECTION_REQUEST.setPacketHandler(new PacketImprintSelectionRequest()); - PacketIdClient.IMPRINT_SELECTION_RESPONSE.setPacketHandler(new PacketImprintSelectionResponse()); PacketIdClient.TILE_FORESTRY_ACTIVE.setPacketHandler(new PacketActiveUpdate()); PacketIdClient.BEE_LOGIC_ACTIVE.setPacketHandler(new PacketBeekeepingLogicActive());