diff --git a/src/main/java/forestry/apiculture/BeekeepingLogic.java b/src/main/java/forestry/apiculture/BeekeepingLogic.java index 03e77a240..cb54b0b48 100755 --- a/src/main/java/forestry/apiculture/BeekeepingLogic.java +++ b/src/main/java/forestry/apiculture/BeekeepingLogic.java @@ -38,8 +38,8 @@ import forestry.api.core.IErrorLogic; import forestry.api.core.IErrorState; import forestry.api.genetics.IEffectData; import forestry.api.genetics.IIndividual; -import forestry.apiculture.network.PacketBeeLogicActive; -import forestry.apiculture.network.PacketBeeLogicActiveEntity; +import forestry.apiculture.network.packets.PacketBeeLogicActive; +import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity; import forestry.core.config.Constants; import forestry.core.config.ForestryItem; import forestry.core.errors.EnumErrorCode; diff --git a/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java b/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java index 98b739f23..ee1da4304 100644 --- a/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java +++ b/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java @@ -29,7 +29,7 @@ import forestry.api.core.EnumTemperature; import forestry.api.core.ForestryAPI; import forestry.api.core.IErrorLogic; import forestry.apiculture.gui.IGuiBeeHousingInventory; -import forestry.apiculture.network.PacketBeeLogicEntityRequest; +import forestry.apiculture.network.packets.PacketBeeLogicEntityRequest; import forestry.apiculture.tiles.TileBeeHousingBase; import forestry.core.entities.EntityMinecartContainerForestry; import forestry.core.network.DataInputStreamForestry; diff --git a/src/main/java/forestry/apiculture/gui/ContainerAlveary.java b/src/main/java/forestry/apiculture/gui/ContainerAlveary.java index fb89622d3..3c34ed6a1 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerAlveary.java +++ b/src/main/java/forestry/apiculture/gui/ContainerAlveary.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.InventoryPlayer; import forestry.apiculture.multiblock.TileAlvearyPlain; import forestry.core.gui.ContainerTile; -import forestry.core.network.PacketGuiUpdate; +import forestry.core.network.packets.PacketGuiUpdate; public class ContainerAlveary extends ContainerTile { diff --git a/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java b/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java index f36144f2a..9235477b5 100644 --- a/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java +++ b/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.InventoryPlayer; import forestry.apiculture.tiles.TileBeeHousingBase; import forestry.core.gui.ContainerTile; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketGuiUpdate; +import forestry.core.network.packets.PacketGuiUpdate; public class ContainerBeeHousing extends ContainerTile implements IContainerBeeHousing { diff --git a/src/main/java/forestry/apiculture/gui/ContainerImprinter.java b/src/main/java/forestry/apiculture/gui/ContainerImprinter.java index 0065d001f..4830e446d 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerImprinter.java +++ b/src/main/java/forestry/apiculture/gui/ContainerImprinter.java @@ -14,12 +14,12 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import forestry.apiculture.inventory.ItemInventoryImprinter; -import forestry.apiculture.network.PacketImprintSelectionResponse; +import forestry.apiculture.network.packets.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.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; public class ContainerImprinter extends ContainerItemInventory implements IGuiSelectable { diff --git a/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java b/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java index 69e1ab1f6..d3a171e81 100644 --- a/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java +++ b/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.InventoryPlayer; import forestry.apiculture.entities.EntityMinecartBeeHousingBase; import forestry.core.gui.ContainerEntity; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketGuiUpdateEntity; +import forestry.core.network.packets.PacketGuiUpdateEntity; public class ContainerMinecartBeehouse extends ContainerEntity implements IContainerBeeHousing { public ContainerMinecartBeehouse(InventoryPlayer player, EntityMinecartBeeHousingBase entity, boolean hasFrames) { diff --git a/src/main/java/forestry/apiculture/gui/GuiImprinter.java b/src/main/java/forestry/apiculture/gui/GuiImprinter.java index eeeaff5f7..d92ec97a0 100755 --- a/src/main/java/forestry/apiculture/gui/GuiImprinter.java +++ b/src/main/java/forestry/apiculture/gui/GuiImprinter.java @@ -26,7 +26,7 @@ import forestry.core.config.Constants; import forestry.core.config.ForestryItem; import forestry.core.gui.GuiForestry; import forestry.core.gui.GuiUtil; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.core.utils.StringUtil; diff --git a/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java b/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java index b3ceef262..6467d6de7 100644 --- a/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java +++ b/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java @@ -25,7 +25,7 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.BiomeDictionary; import forestry.api.apiculture.IBee; -import forestry.apiculture.network.PacketHabitatBiomePointer; +import forestry.apiculture.network.packets.PacketHabitatBiomePointer; import forestry.core.proxy.Proxies; import forestry.core.utils.vect.Vect; diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java index 21c67122b..81f2ff88a 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java @@ -16,7 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection; import forestry.api.core.IClimateControlled; import forestry.api.multiblock.IAlvearyComponent; -import forestry.apiculture.network.PacketActiveUpdate; +import forestry.apiculture.network.packets.PacketActiveUpdate; import forestry.core.proxy.Proxies; import forestry.core.tiles.IActivatable; import forestry.energy.EnergyManager; diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java index 1e6b2a717..04bd914e5 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java @@ -24,7 +24,7 @@ import forestry.api.apiculture.IBee; import forestry.api.multiblock.IAlvearyComponent; import forestry.apiculture.blocks.BlockAlveary; import forestry.apiculture.inventory.InventorySwarmer; -import forestry.apiculture.network.PacketActiveUpdate; +import forestry.apiculture.network.packets.PacketActiveUpdate; import forestry.apiculture.worldgen.Hive; import forestry.apiculture.worldgen.HiveDecorator; import forestry.apiculture.worldgen.HiveDescriptionSwarmer; diff --git a/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java b/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java new file mode 100644 index 000000000..c92709727 --- /dev/null +++ b/src/main/java/forestry/apiculture/network/PacketRegistryApiculture.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.apiculture.network; + +import forestry.apiculture.network.packets.PacketActiveUpdate; +import forestry.apiculture.network.packets.PacketBeeLogicActive; +import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity; +import forestry.apiculture.network.packets.PacketBeeLogicEntityRequest; +import forestry.apiculture.network.packets.PacketCandleUpdate; +import forestry.apiculture.network.packets.PacketHabitatBiomePointer; +import forestry.apiculture.network.packets.PacketImprintSelectionResponse; +import forestry.core.network.PacketRegistry; + +public class PacketRegistryApiculture extends PacketRegistry { + @Override + public void registerPackets() { + registerClientPacket(new PacketImprintSelectionResponse()); + registerClientPacket(new PacketActiveUpdate()); + registerClientPacket(new PacketBeeLogicActive()); + registerClientPacket(new PacketBeeLogicActiveEntity()); + registerClientPacket(new PacketHabitatBiomePointer()); + registerClientPacket(new PacketCandleUpdate()); + + registerServerPacket(new PacketBeeLogicEntityRequest()); + } +} diff --git a/src/main/java/forestry/apiculture/network/PacketActiveUpdate.java b/src/main/java/forestry/apiculture/network/packets/PacketActiveUpdate.java similarity index 85% rename from src/main/java/forestry/apiculture/network/PacketActiveUpdate.java rename to src/main/java/forestry/apiculture/network/packets/PacketActiveUpdate.java index 9800a3f71..249c024f3 100644 --- a/src/main/java/forestry/apiculture/network/PacketActiveUpdate.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketActiveUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -18,8 +18,8 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; import forestry.core.tiles.IActivatable; @@ -31,10 +31,15 @@ public class PacketActiveUpdate extends PacketCoordinates implements IForestryPa } public PacketActiveUpdate(IActivatable tile) { - super(PacketIdClient.TILE_FORESTRY_ACTIVE, tile.getCoordinates()); + super(tile.getCoordinates()); this.active = tile.isActive(); } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.TILE_FORESTRY_ACTIVE; + } + @Override protected void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/apiculture/network/PacketBeeLogicActive.java b/src/main/java/forestry/apiculture/network/packets/PacketBeeLogicActive.java similarity index 87% rename from src/main/java/forestry/apiculture/network/PacketBeeLogicActive.java rename to src/main/java/forestry/apiculture/network/packets/PacketBeeLogicActive.java index 3a40061a2..167bed090 100644 --- a/src/main/java/forestry/apiculture/network/PacketBeeLogicActive.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketBeeLogicActive.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -21,8 +21,8 @@ import forestry.apiculture.BeekeepingLogic; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; public class PacketBeeLogicActive extends PacketCoordinates implements IForestryPacketClient { @@ -32,10 +32,15 @@ public class PacketBeeLogicActive extends PacketCoordinates implements IForestry } public PacketBeeLogicActive(IBeeHousing tile) { - super(PacketIdClient.BEE_LOGIC_ACTIVE, tile.getCoordinates()); + super(tile.getCoordinates()); this.beekeepingLogic = (BeekeepingLogic) tile.getBeekeepingLogic(); } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.BEE_LOGIC_ACTIVE; + } + @Override protected void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/apiculture/network/PacketBeeLogicActiveEntity.java b/src/main/java/forestry/apiculture/network/packets/PacketBeeLogicActiveEntity.java similarity index 87% rename from src/main/java/forestry/apiculture/network/PacketBeeLogicActiveEntity.java rename to src/main/java/forestry/apiculture/network/packets/PacketBeeLogicActiveEntity.java index 1d533cc5b..0b94cd232 100644 --- a/src/main/java/forestry/apiculture/network/PacketBeeLogicActiveEntity.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketBeeLogicActiveEntity.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -21,8 +21,8 @@ import forestry.apiculture.BeekeepingLogic; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketEntityUpdate; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketEntityUpdate; import forestry.core.proxy.Proxies; public class PacketBeeLogicActiveEntity extends PacketEntityUpdate implements IForestryPacketClient { @@ -32,10 +32,15 @@ public class PacketBeeLogicActiveEntity extends PacketEntityUpdate implements IF } public PacketBeeLogicActiveEntity(IBeeHousing housing, Entity entity) { - super(PacketIdClient.BEE_LOGIC_ACTIVE_ENTITY, entity); + super(entity); this.beekeepingLogic = (BeekeepingLogic) housing.getBeekeepingLogic(); } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.BEE_LOGIC_ACTIVE_ENTITY; + } + @Override protected void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/apiculture/network/PacketBeeLogicEntityRequest.java b/src/main/java/forestry/apiculture/network/packets/PacketBeeLogicEntityRequest.java similarity index 84% rename from src/main/java/forestry/apiculture/network/PacketBeeLogicEntityRequest.java rename to src/main/java/forestry/apiculture/network/packets/PacketBeeLogicEntityRequest.java index 3ee25ec67..ec94f48b4 100644 --- a/src/main/java/forestry/apiculture/network/PacketBeeLogicEntityRequest.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketBeeLogicEntityRequest.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -19,8 +19,8 @@ import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeekeepingLogic; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.IForestryPacketServer; -import forestry.core.network.PacketEntityUpdate; import forestry.core.network.PacketIdServer; +import forestry.core.network.packets.PacketEntityUpdate; public class PacketBeeLogicEntityRequest extends PacketEntityUpdate implements IForestryPacketServer { @@ -28,7 +28,12 @@ public class PacketBeeLogicEntityRequest extends PacketEntityUpdate implements I } public PacketBeeLogicEntityRequest(Entity entity) { - super(PacketIdServer.BEE_LOGIC_ACTIVE_ENTITY_REQUEST, entity); + super(entity); + } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.BEE_LOGIC_ACTIVE_ENTITY_REQUEST; } @Override diff --git a/src/main/java/forestry/apiculture/network/PacketCandleUpdate.java b/src/main/java/forestry/apiculture/network/packets/PacketCandleUpdate.java similarity index 87% rename from src/main/java/forestry/apiculture/network/PacketCandleUpdate.java rename to src/main/java/forestry/apiculture/network/packets/PacketCandleUpdate.java index 7093cce64..4200ac7d1 100644 --- a/src/main/java/forestry/apiculture/network/PacketCandleUpdate.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketCandleUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -19,8 +19,8 @@ import forestry.apiculture.tiles.TileCandle; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; public class PacketCandleUpdate extends PacketCoordinates implements IForestryPacketClient { @@ -32,12 +32,17 @@ public class PacketCandleUpdate extends PacketCoordinates implements IForestryPa } public PacketCandleUpdate(TileCandle tileCandle) { - super(PacketIdClient.CANDLE_UPDATE, tileCandle); + super(tileCandle); colour = tileCandle.getColour(); lit = tileCandle.isLit(); } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.CANDLE_UPDATE; + } + @Override public void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/apiculture/network/PacketHabitatBiomePointer.java b/src/main/java/forestry/apiculture/network/packets/PacketHabitatBiomePointer.java similarity index 82% rename from src/main/java/forestry/apiculture/network/PacketHabitatBiomePointer.java rename to src/main/java/forestry/apiculture/network/packets/PacketHabitatBiomePointer.java index 7525e6ee6..8393cf2e7 100644 --- a/src/main/java/forestry/apiculture/network/PacketHabitatBiomePointer.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketHabitatBiomePointer.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -17,8 +17,8 @@ import net.minecraft.util.ChunkCoordinates; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; public class PacketHabitatBiomePointer extends PacketCoordinates implements IForestryPacketClient { @@ -27,7 +27,12 @@ public class PacketHabitatBiomePointer extends PacketCoordinates implements IFor } public PacketHabitatBiomePointer(ChunkCoordinates coordinates) { - super(PacketIdClient.HABITAT_BIOME_POINTER, coordinates); + super(coordinates); + } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.HABITAT_BIOME_POINTER; } @Override diff --git a/src/main/java/forestry/apiculture/network/PacketImprintSelectionResponse.java b/src/main/java/forestry/apiculture/network/packets/PacketImprintSelectionResponse.java similarity index 83% rename from src/main/java/forestry/apiculture/network/PacketImprintSelectionResponse.java rename to src/main/java/forestry/apiculture/network/packets/PacketImprintSelectionResponse.java index b8574a488..bd1905fc4 100644 --- a/src/main/java/forestry/apiculture/network/PacketImprintSelectionResponse.java +++ b/src/main/java/forestry/apiculture/network/packets/PacketImprintSelectionResponse.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.apiculture.network; +package forestry.apiculture.network.packets; import java.io.IOException; @@ -18,8 +18,8 @@ import net.minecraft.inventory.Container; import forestry.apiculture.gui.ContainerImprinter; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketGuiSelect; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketGuiSelect; public class PacketImprintSelectionResponse extends PacketGuiSelect implements IForestryPacketClient { @@ -27,7 +27,12 @@ public class PacketImprintSelectionResponse extends PacketGuiSelect implements I } public PacketImprintSelectionResponse(int primaryIndex, int secondaryIndex) { - super(PacketIdClient.IMPRINT_SELECTION_RESPONSE, primaryIndex, secondaryIndex); + super(primaryIndex, secondaryIndex); + } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.IMPRINT_SELECTION_RESPONSE; } @Override diff --git a/src/main/java/forestry/apiculture/tiles/TileCandle.java b/src/main/java/forestry/apiculture/tiles/TileCandle.java index ec097cbb5..fe11313df 100644 --- a/src/main/java/forestry/apiculture/tiles/TileCandle.java +++ b/src/main/java/forestry/apiculture/tiles/TileCandle.java @@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; -import forestry.apiculture.network.PacketCandleUpdate; +import forestry.apiculture.network.packets.PacketCandleUpdate; public class TileCandle extends TileEntity { private int colour; diff --git a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java index 90d229d94..b5f5eb19e 100755 --- a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java +++ b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java @@ -37,7 +37,7 @@ import forestry.arboriculture.genetics.TreeGenome; import forestry.arboriculture.genetics.pollination.ICheckPollinatable; import forestry.core.config.Config; import forestry.core.genetics.ItemGE; -import forestry.core.network.PacketFXSignal; +import forestry.core.network.packets.PacketFXSignal; import forestry.core.proxy.Proxies; import forestry.core.render.SpriteSheet; import forestry.core.utils.BlockUtil; diff --git a/src/main/java/forestry/arboriculture/network/PacketRegistryArboriculture.java b/src/main/java/forestry/arboriculture/network/PacketRegistryArboriculture.java new file mode 100644 index 000000000..a217bf55a --- /dev/null +++ b/src/main/java/forestry/arboriculture/network/PacketRegistryArboriculture.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.arboriculture.network; + +import forestry.arboriculture.network.packets.PacketRipeningUpdate; +import forestry.core.network.PacketRegistry; + +public class PacketRegistryArboriculture extends PacketRegistry { + @Override + public void registerPackets() { + registerClientPacket(new PacketRipeningUpdate()); + } +} diff --git a/src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java b/src/main/java/forestry/arboriculture/network/packets/PacketRipeningUpdate.java similarity index 84% rename from src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java rename to src/main/java/forestry/arboriculture/network/packets/PacketRipeningUpdate.java index 125764688..967ff814c 100644 --- a/src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java +++ b/src/main/java/forestry/arboriculture/network/packets/PacketRipeningUpdate.java @@ -8,20 +8,21 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.arboriculture.network; +package forestry.arboriculture.network.packets; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import forestry.arboriculture.network.IRipeningPacketReceiver; import forestry.arboriculture.tiles.TileFruitPod; import forestry.arboriculture.tiles.TileLeaves; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; public class PacketRipeningUpdate extends PacketCoordinates implements IForestryPacketClient { @@ -32,15 +33,20 @@ public class PacketRipeningUpdate extends PacketCoordinates implements IForestry } public PacketRipeningUpdate(TileFruitPod fruitPod) { - super(PacketIdClient.RIPENING_UPDATE, fruitPod); + super(fruitPod); value = fruitPod.getMaturity(); } public PacketRipeningUpdate(TileLeaves leaves) { - super(PacketIdClient.RIPENING_UPDATE, leaves); + super(leaves); value = leaves.getFruitColour(); } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.RIPENING_UPDATE; + } + @Override public void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java b/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java index 589e08b90..6f6a221e8 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java +++ b/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java @@ -30,11 +30,11 @@ import forestry.api.genetics.IAllele; import forestry.api.genetics.IFruitBearer; import forestry.api.genetics.IFruitFamily; import forestry.arboriculture.network.IRipeningPacketReceiver; -import forestry.arboriculture.network.PacketRipeningUpdate; +import forestry.arboriculture.network.packets.PacketRipeningUpdate; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IStreamable; -import forestry.core.network.PacketTileStream; +import forestry.core.network.packets.PacketTileStream; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; diff --git a/src/main/java/forestry/arboriculture/tiles/TileLeaves.java b/src/main/java/forestry/arboriculture/tiles/TileLeaves.java index 81d4a6380..e57db6f46 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileLeaves.java +++ b/src/main/java/forestry/arboriculture/tiles/TileLeaves.java @@ -54,10 +54,10 @@ import forestry.arboriculture.genetics.Tree; import forestry.arboriculture.genetics.TreeDefinition; import forestry.arboriculture.genetics.alleles.AlleleFruit; import forestry.arboriculture.network.IRipeningPacketReceiver; -import forestry.arboriculture.network.PacketRipeningUpdate; +import forestry.arboriculture.network.packets.PacketRipeningUpdate; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; -import forestry.core.network.PacketTileStream; +import forestry.core.network.packets.PacketTileStream; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; import forestry.core.utils.ColourUtil; diff --git a/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java b/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java index 62b63045b..89290b647 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java +++ b/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java @@ -30,7 +30,7 @@ import forestry.core.access.IOwnable; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IStreamable; -import forestry.core.network.PacketTileStream; +import forestry.core.network.packets.PacketTileStream; import forestry.core.utils.PlayerUtil; /** diff --git a/src/main/java/forestry/arboriculture/tiles/TileWood.java b/src/main/java/forestry/arboriculture/tiles/TileWood.java index 9205803c7..61bb37bd2 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileWood.java +++ b/src/main/java/forestry/arboriculture/tiles/TileWood.java @@ -27,7 +27,7 @@ import forestry.arboriculture.items.ItemBlockWood; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IStreamable; -import forestry.core.network.PacketTileStream; +import forestry.core.network.packets.PacketTileStream; import forestry.core.tiles.TileUtil; public class TileWood extends TileEntity implements IStreamable { diff --git a/src/main/java/forestry/core/access/AccessHandler.java b/src/main/java/forestry/core/access/AccessHandler.java index 475ce8de7..82c9b07f8 100644 --- a/src/main/java/forestry/core/access/AccessHandler.java +++ b/src/main/java/forestry/core/access/AccessHandler.java @@ -26,8 +26,8 @@ import com.mojang.authlib.GameProfile; import forestry.core.config.Config; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; -import forestry.core.network.PacketAccessSwitch; -import forestry.core.network.PacketAccessSwitchEntity; +import forestry.core.network.packets.PacketAccessSwitch; +import forestry.core.network.packets.PacketAccessSwitchEntity; import forestry.core.proxy.Proxies; import forestry.core.tiles.ILocatable; import forestry.core.utils.PlayerUtil; diff --git a/src/main/java/forestry/core/circuits/ContainerSolderingIron.java b/src/main/java/forestry/core/circuits/ContainerSolderingIron.java index 1af798710..fca543ad1 100755 --- a/src/main/java/forestry/core/circuits/ContainerSolderingIron.java +++ b/src/main/java/forestry/core/circuits/ContainerSolderingIron.java @@ -21,8 +21,8 @@ import forestry.core.gui.slots.SlotOutput; import forestry.core.inventory.ItemInventorySolderingIron; import forestry.core.network.IForestryPacketClient; import forestry.core.network.IForestryPacketServer; -import forestry.core.network.PacketGuiLayoutSelect; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiLayoutSelect; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; public class ContainerSolderingIron extends ContainerItemInventory implements IGuiSelectable { diff --git a/src/main/java/forestry/core/fluids/TankManager.java b/src/main/java/forestry/core/fluids/TankManager.java index 6f3e98c64..52762a0af 100644 --- a/src/main/java/forestry/core/fluids/TankManager.java +++ b/src/main/java/forestry/core/fluids/TankManager.java @@ -40,7 +40,7 @@ import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; import forestry.core.network.IStreamable; -import forestry.core.network.PacketTankLevelUpdate; +import forestry.core.network.packets.PacketTankLevelUpdate; import forestry.core.proxy.Proxies; import forestry.core.render.EnumTankLevel; import forestry.core.tiles.ILiquidTankTile; diff --git a/src/main/java/forestry/core/genetics/BreedingTracker.java b/src/main/java/forestry/core/genetics/BreedingTracker.java index 6cd994d2a..2dc1bd2ab 100755 --- a/src/main/java/forestry/core/genetics/BreedingTracker.java +++ b/src/main/java/forestry/core/genetics/BreedingTracker.java @@ -31,7 +31,7 @@ import forestry.api.genetics.IBreedingTracker; import forestry.api.genetics.IIndividual; import forestry.api.genetics.IMutation; import forestry.api.genetics.ISpeciesRoot; -import forestry.core.network.PacketGenomeTrackerUpdate; +import forestry.core.network.packets.PacketGenomeTrackerUpdate; import forestry.core.proxy.Proxies; public abstract class BreedingTracker extends WorldSavedData implements IBreedingTracker { diff --git a/src/main/java/forestry/core/gui/ContainerEntity.java b/src/main/java/forestry/core/gui/ContainerEntity.java index af1d91bf9..5b35582d5 100644 --- a/src/main/java/forestry/core/gui/ContainerEntity.java +++ b/src/main/java/forestry/core/gui/ContainerEntity.java @@ -24,8 +24,8 @@ import forestry.core.access.FakeAccessHandler; import forestry.core.access.IAccessHandler; import forestry.core.access.IRestrictedAccess; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketAccessUpdateEntity; -import forestry.core.network.PacketErrorUpdateEntity; +import forestry.core.network.packets.PacketAccessUpdateEntity; +import forestry.core.network.packets.PacketErrorUpdateEntity; public class ContainerEntity extends ContainerForestry { protected final T entity; diff --git a/src/main/java/forestry/core/gui/ContainerEscritoire.java b/src/main/java/forestry/core/gui/ContainerEscritoire.java index 05bff3c5a..6d8921021 100755 --- a/src/main/java/forestry/core/gui/ContainerEscritoire.java +++ b/src/main/java/forestry/core/gui/ContainerEscritoire.java @@ -16,8 +16,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import forestry.core.gui.slots.SlotFiltered; import forestry.core.gui.slots.SlotOutput; import forestry.core.inventory.InventoryEscritoire; -import forestry.core.network.PacketGuiSelectRequest; -import forestry.core.network.PacketGuiUpdate; +import forestry.core.network.packets.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiUpdate; import forestry.core.proxy.Proxies; import forestry.core.tiles.EscritoireGame; import forestry.core.tiles.TileEscritoire; diff --git a/src/main/java/forestry/core/gui/ContainerLiquidTanksHelper.java b/src/main/java/forestry/core/gui/ContainerLiquidTanksHelper.java index c28b3a094..8aafd16dd 100644 --- a/src/main/java/forestry/core/gui/ContainerLiquidTanksHelper.java +++ b/src/main/java/forestry/core/gui/ContainerLiquidTanksHelper.java @@ -20,7 +20,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; import forestry.api.core.IToolPipette; -import forestry.core.network.PacketPipetteClick; +import forestry.core.network.packets.PacketPipetteClick; import forestry.core.proxy.Proxies; import forestry.core.tiles.ILiquidTankTile; diff --git a/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java b/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java index aa4caad89..4fcb6ecb1 100755 --- a/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java +++ b/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import forestry.core.gui.slots.SlotFiltered; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.tiles.TileNaturalistChest; public class ContainerNaturalistInventory extends ContainerTile implements IGuiSelectable { diff --git a/src/main/java/forestry/core/gui/ContainerSocketedHelper.java b/src/main/java/forestry/core/gui/ContainerSocketedHelper.java index 4cd77ab72..bff547c9f 100644 --- a/src/main/java/forestry/core/gui/ContainerSocketedHelper.java +++ b/src/main/java/forestry/core/gui/ContainerSocketedHelper.java @@ -17,9 +17,9 @@ import net.minecraft.tileentity.TileEntity; import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ICircuitBoard; import forestry.core.circuits.ISocketable; -import forestry.core.network.PacketChipsetClick; -import forestry.core.network.PacketSocketUpdate; -import forestry.core.network.PacketSolderingIronClick; +import forestry.core.network.packets.PacketChipsetClick; +import forestry.core.network.packets.PacketSocketUpdate; +import forestry.core.network.packets.PacketSolderingIronClick; import forestry.core.proxy.Proxies; import forestry.core.utils.InventoryUtil; diff --git a/src/main/java/forestry/core/gui/ContainerTile.java b/src/main/java/forestry/core/gui/ContainerTile.java index 405d7bc50..d5c699309 100644 --- a/src/main/java/forestry/core/gui/ContainerTile.java +++ b/src/main/java/forestry/core/gui/ContainerTile.java @@ -23,10 +23,10 @@ import forestry.core.access.FakeAccessHandler; import forestry.core.access.IAccessHandler; import forestry.core.access.IRestrictedAccess; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketAccessUpdate; -import forestry.core.network.PacketErrorUpdate; -import forestry.core.network.PacketGuiEnergy; -import forestry.core.network.PacketGuiUpdate; +import forestry.core.network.packets.PacketAccessUpdate; +import forestry.core.network.packets.PacketErrorUpdate; +import forestry.core.network.packets.PacketGuiEnergy; +import forestry.core.network.packets.PacketGuiUpdate; import forestry.core.tiles.IPowerHandler; import forestry.core.tiles.TilePowered; import forestry.core.tiles.TileUtil; diff --git a/src/main/java/forestry/core/gui/GuiNaturalistInventory.java b/src/main/java/forestry/core/gui/GuiNaturalistInventory.java index 140e0a708..ec89daf20 100755 --- a/src/main/java/forestry/core/gui/GuiNaturalistInventory.java +++ b/src/main/java/forestry/core/gui/GuiNaturalistInventory.java @@ -30,7 +30,7 @@ import forestry.core.config.Constants; import forestry.core.genetics.mutations.EnumMutateChance; import forestry.core.gui.buttons.GuiBetterButton; import forestry.core.gui.buttons.StandardButtonTextureSets; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.core.utils.StringUtil; diff --git a/src/main/java/forestry/core/gui/IGuiSelectable.java b/src/main/java/forestry/core/gui/IGuiSelectable.java index df5b173ad..34cf95fe0 100755 --- a/src/main/java/forestry/core/gui/IGuiSelectable.java +++ b/src/main/java/forestry/core/gui/IGuiSelectable.java @@ -12,7 +12,7 @@ package forestry.core.gui; import net.minecraft.entity.player.EntityPlayerMP; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; public interface IGuiSelectable { // server diff --git a/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java b/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java index 004246fa4..c0c235301 100644 --- a/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java +++ b/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java @@ -19,7 +19,7 @@ import net.minecraft.util.IIcon; import org.lwjgl.opengl.GL11; import forestry.core.gui.GuiUtil; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.core.render.SpriteSheet; import forestry.core.render.TextureManager; diff --git a/src/main/java/forestry/core/gui/widgets/ProbeButton.java b/src/main/java/forestry/core/gui/widgets/ProbeButton.java index cd758bd25..8edeee5eb 100644 --- a/src/main/java/forestry/core/gui/widgets/ProbeButton.java +++ b/src/main/java/forestry/core/gui/widgets/ProbeButton.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import org.lwjgl.opengl.GL11; import forestry.core.gui.GuiEscritoire; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.core.utils.StringUtil; diff --git a/src/main/java/forestry/core/network/ForestryPacket.java b/src/main/java/forestry/core/network/ForestryPacket.java index 0d970dbf2..339e251ea 100755 --- a/src/main/java/forestry/core/network/ForestryPacket.java +++ b/src/main/java/forestry/core/network/ForestryPacket.java @@ -18,17 +18,7 @@ import cpw.mods.fml.common.network.internal.FMLProxyPacket; import io.netty.buffer.Unpooled; public abstract class ForestryPacket implements IForestryPacket { - - protected static final String channel = "FOR"; - - private IPacketId id; - - protected ForestryPacket() { - } - - public ForestryPacket(IPacketId id) { - this.id = id; - } + private final IPacketId id = getPacketId(); public final FMLProxyPacket getPacket() { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -41,7 +31,7 @@ public abstract class ForestryPacket implements IForestryPacket { e.printStackTrace(); } - return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), channel); + return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), PacketHandler.channelId); } protected void writeData(DataOutputStreamForestry data) throws IOException { diff --git a/src/main/java/forestry/core/network/IForestryPacket.java b/src/main/java/forestry/core/network/IForestryPacket.java index fe131c038..e0a77b2a3 100644 --- a/src/main/java/forestry/core/network/IForestryPacket.java +++ b/src/main/java/forestry/core/network/IForestryPacket.java @@ -18,4 +18,6 @@ public interface IForestryPacket { void readData(DataInputStreamForestry data) throws IOException; FMLProxyPacket getPacket(); + + IPacketId getPacketId(); } diff --git a/src/main/java/forestry/core/network/IForestryPacketClient.java b/src/main/java/forestry/core/network/IForestryPacketClient.java index 55f32712d..17a100617 100644 --- a/src/main/java/forestry/core/network/IForestryPacketClient.java +++ b/src/main/java/forestry/core/network/IForestryPacketClient.java @@ -16,4 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; public interface IForestryPacketClient extends IForestryPacket { void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException; + + @Override + PacketIdClient getPacketId(); } diff --git a/src/main/java/forestry/core/network/IForestryPacketServer.java b/src/main/java/forestry/core/network/IForestryPacketServer.java index 6e8a4996f..2c36c6a2f 100644 --- a/src/main/java/forestry/core/network/IForestryPacketServer.java +++ b/src/main/java/forestry/core/network/IForestryPacketServer.java @@ -16,4 +16,7 @@ import net.minecraft.entity.player.EntityPlayerMP; public interface IForestryPacketServer extends IForestryPacket { void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException; + + @Override + PacketIdServer getPacketId(); } diff --git a/src/main/java/forestry/core/network/IPacketRegistry.java b/src/main/java/forestry/core/network/IPacketRegistry.java new file mode 100644 index 000000000..ba9673329 --- /dev/null +++ b/src/main/java/forestry/core/network/IPacketRegistry.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.network; + +public interface IPacketRegistry { + void registerPackets(); +} diff --git a/src/main/java/forestry/core/network/PacketHandler.java b/src/main/java/forestry/core/network/PacketHandler.java index 13d74b7fc..a31fdb6b3 100644 --- a/src/main/java/forestry/core/network/PacketHandler.java +++ b/src/main/java/forestry/core/network/PacketHandler.java @@ -28,10 +28,11 @@ import forestry.core.proxy.Proxies; import io.netty.buffer.ByteBufInputStream; public class PacketHandler { + public static final String channelId = "FOR"; private final FMLEventChannel channel; public PacketHandler() { - channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(ForestryPacket.channel); + channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(channelId); channel.register(this); } diff --git a/src/main/java/forestry/core/network/PacketIdClient.java b/src/main/java/forestry/core/network/PacketIdClient.java index c46f20529..c60c97ef6 100644 --- a/src/main/java/forestry/core/network/PacketIdClient.java +++ b/src/main/java/forestry/core/network/PacketIdClient.java @@ -12,28 +12,30 @@ package forestry.core.network; import javax.annotation.Nonnull; +import forestry.core.network.packets.PacketDummyClient; + public enum PacketIdClient implements IPacketId { INVALID, // Core Gui - ERROR_UPDATE(new PacketErrorUpdate()), - ERROR_UPDATE_ENTITY(new PacketErrorUpdateEntity()), - GUI_UPDATE(new PacketGuiUpdate()), - GUI_UPDATE_ENTITY(new PacketGuiUpdateEntity()), - GUI_LAYOUT_SELECT(new PacketGuiLayoutSelect()), - GUI_ENERGY(new PacketGuiEnergy()), - SOCKET_UPDATE(new PacketSocketUpdate()), - ACCESS_UPDATE(new PacketAccessUpdate()), - ACCESS_UPDATE_ENTITY(new PacketAccessUpdateEntity()), + ERROR_UPDATE, + ERROR_UPDATE_ENTITY, + GUI_UPDATE, + GUI_UPDATE_ENTITY, + GUI_LAYOUT_SELECT, + GUI_ENERGY, + SOCKET_UPDATE, + ACCESS_UPDATE, + ACCESS_UPDATE_ENTITY, // Core Tile Entities - TILE_FORESTRY_UPDATE(new PacketTileStream()), - ITEMSTACK_DISPLAY(new PacketItemStackDisplay()), - FX_SIGNAL(new PacketFXSignal()), - TANK_LEVEL_UPDATE(new PacketTankLevelUpdate()), + TILE_FORESTRY_UPDATE, + ITEMSTACK_DISPLAY, + FX_SIGNAL, + TANK_LEVEL_UPDATE, // Core Genome - GENOME_TRACKER_UPDATE(new PacketGenomeTrackerUpdate()), + GENOME_TRACKER_UPDATE, // Factory WORKTABLE_MEMORY_UPDATE, @@ -61,11 +63,7 @@ public enum PacketIdClient implements IPacketId { private IForestryPacketClient packetHandler; PacketIdClient() { - this.packetHandler = PacketDummy.instance; - } - - PacketIdClient(@Nonnull IForestryPacketClient packetHandler) { - this.packetHandler = packetHandler; + this.packetHandler = PacketDummyClient.instance; } public void setPacketHandler(@Nonnull IForestryPacketClient packetHandler) { diff --git a/src/main/java/forestry/core/network/PacketIdServer.java b/src/main/java/forestry/core/network/PacketIdServer.java index b7cfc0b8d..b970106ae 100644 --- a/src/main/java/forestry/core/network/PacketIdServer.java +++ b/src/main/java/forestry/core/network/PacketIdServer.java @@ -12,16 +12,18 @@ package forestry.core.network; import javax.annotation.Nonnull; +import forestry.core.network.packets.PacketDummyServer; + public enum PacketIdServer implements IPacketId { INVALID, // Core Gui - GUI_SELECTION_REQUEST(new PacketGuiSelectRequest()), - PIPETTE_CLICK(new PacketPipetteClick()), - ACCESS_SWITCH(new PacketAccessSwitch()), - ACCESS_SWITCH_ENTITY(new PacketAccessSwitchEntity()), - CHIPSET_CLICK(new PacketChipsetClick()), - SOLDERING_IRON_CLICK(new PacketSolderingIronClick()), + GUI_SELECTION_REQUEST, + PIPETTE_CLICK, + ACCESS_SWITCH, + ACCESS_SWITCH_ENTITY, + CHIPSET_CLICK, + SOLDERING_IRON_CLICK, // Apiculture BEE_LOGIC_ACTIVE_ENTITY_REQUEST, @@ -41,11 +43,7 @@ public enum PacketIdServer implements IPacketId { private IForestryPacketServer packetHandler; PacketIdServer() { - this.packetHandler = PacketDummy.instance; - } - - PacketIdServer(@Nonnull IForestryPacketServer packetHandler) { - this.packetHandler = packetHandler; + this.packetHandler = PacketDummyServer.instance; } public void setPacketHandler(@Nonnull IForestryPacketServer packetHandler) { diff --git a/src/main/java/forestry/core/network/PacketRegistry.java b/src/main/java/forestry/core/network/PacketRegistry.java new file mode 100644 index 000000000..4a2c72e74 --- /dev/null +++ b/src/main/java/forestry/core/network/PacketRegistry.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.network; + +public abstract class PacketRegistry implements IPacketRegistry { + protected static void registerClientPacket(IForestryPacketClient packet) { + packet.getPacketId().setPacketHandler(packet); + } + + protected static void registerServerPacket(IForestryPacketServer packet) { + packet.getPacketId().setPacketHandler(packet); + } +} diff --git a/src/main/java/forestry/core/network/PacketRegistryCore.java b/src/main/java/forestry/core/network/PacketRegistryCore.java new file mode 100644 index 000000000..943194005 --- /dev/null +++ b/src/main/java/forestry/core/network/PacketRegistryCore.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.network; + +import forestry.core.network.packets.PacketAccessSwitch; +import forestry.core.network.packets.PacketAccessSwitchEntity; +import forestry.core.network.packets.PacketAccessUpdate; +import forestry.core.network.packets.PacketAccessUpdateEntity; +import forestry.core.network.packets.PacketChipsetClick; +import forestry.core.network.packets.PacketErrorUpdate; +import forestry.core.network.packets.PacketErrorUpdateEntity; +import forestry.core.network.packets.PacketFXSignal; +import forestry.core.network.packets.PacketGenomeTrackerUpdate; +import forestry.core.network.packets.PacketGuiEnergy; +import forestry.core.network.packets.PacketGuiLayoutSelect; +import forestry.core.network.packets.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiUpdate; +import forestry.core.network.packets.PacketGuiUpdateEntity; +import forestry.core.network.packets.PacketItemStackDisplay; +import forestry.core.network.packets.PacketPipetteClick; +import forestry.core.network.packets.PacketSocketUpdate; +import forestry.core.network.packets.PacketSolderingIronClick; +import forestry.core.network.packets.PacketTankLevelUpdate; +import forestry.core.network.packets.PacketTileStream; + +public class PacketRegistryCore extends PacketRegistry { + @Override + public void registerPackets() { + registerClientPacket(new PacketErrorUpdate()); + registerClientPacket(new PacketErrorUpdateEntity()); + registerClientPacket(new PacketGuiUpdate()); + registerClientPacket(new PacketGuiUpdateEntity()); + registerClientPacket(new PacketGuiLayoutSelect()); + registerClientPacket(new PacketGuiEnergy()); + registerClientPacket(new PacketSocketUpdate()); + registerClientPacket(new PacketAccessUpdate()); + registerClientPacket(new PacketAccessUpdateEntity()); + registerClientPacket(new PacketTileStream()); + registerClientPacket(new PacketItemStackDisplay()); + registerClientPacket(new PacketFXSignal()); + registerClientPacket(new PacketTankLevelUpdate()); + registerClientPacket(new PacketGenomeTrackerUpdate()); + + registerServerPacket(new PacketGuiSelectRequest()); + registerServerPacket(new PacketPipetteClick()); + registerServerPacket(new PacketAccessSwitch()); + registerServerPacket(new PacketAccessSwitchEntity()); + registerServerPacket(new PacketChipsetClick()); + registerServerPacket(new PacketSolderingIronClick()); + } +} diff --git a/src/main/java/forestry/core/network/PacketRegistryDummy.java b/src/main/java/forestry/core/network/PacketRegistryDummy.java new file mode 100644 index 000000000..3aadef49a --- /dev/null +++ b/src/main/java/forestry/core/network/PacketRegistryDummy.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.network; + +public class PacketRegistryDummy implements IPacketRegistry { + public static final PacketRegistryDummy instance = new PacketRegistryDummy(); + + private PacketRegistryDummy() { + + } + + @Override + public void registerPackets() { + + } +} diff --git a/src/main/java/forestry/core/network/PacketAccessSwitch.java b/src/main/java/forestry/core/network/packets/PacketAccessSwitch.java similarity index 78% rename from src/main/java/forestry/core/network/PacketAccessSwitch.java rename to src/main/java/forestry/core/network/packets/PacketAccessSwitch.java index 878224a86..2baac01c6 100644 --- a/src/main/java/forestry/core/network/PacketAccessSwitch.java +++ b/src/main/java/forestry/core/network/packets/PacketAccessSwitch.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; import forestry.core.access.IRestrictedAccess; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; import forestry.core.tiles.ILocatable; public class PacketAccessSwitch extends PacketCoordinates implements IForestryPacketServer { @@ -24,7 +27,7 @@ public class PacketAccessSwitch extends PacketCoordinates implements IForestryPa } public PacketAccessSwitch(ILocatable tile) { - super(PacketIdServer.ACCESS_SWITCH, tile.getCoordinates()); + super(tile.getCoordinates()); } @Override @@ -36,4 +39,9 @@ public class PacketAccessSwitch extends PacketCoordinates implements IForestryPa restrictedAccessTile.getAccessHandler().switchAccess(player); } } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.ACCESS_SWITCH; + } } diff --git a/src/main/java/forestry/core/network/PacketAccessSwitchEntity.java b/src/main/java/forestry/core/network/packets/PacketAccessSwitchEntity.java similarity index 78% rename from src/main/java/forestry/core/network/PacketAccessSwitchEntity.java rename to src/main/java/forestry/core/network/packets/PacketAccessSwitchEntity.java index a3c2fb0a2..3e04e5906 100644 --- a/src/main/java/forestry/core/network/PacketAccessSwitchEntity.java +++ b/src/main/java/forestry/core/network/packets/PacketAccessSwitchEntity.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,9 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import forestry.core.access.IRestrictedAccess; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; public class PacketAccessSwitchEntity extends PacketEntityUpdate implements IForestryPacketServer { @@ -23,7 +26,7 @@ public class PacketAccessSwitchEntity extends PacketEntityUpdate implements IFor } public PacketAccessSwitchEntity(Entity entity) { - super(PacketIdServer.ACCESS_SWITCH_ENTITY, entity); + super(entity); } @Override @@ -34,4 +37,9 @@ public class PacketAccessSwitchEntity extends PacketEntityUpdate implements IFor restrictedAccessTile.getAccessHandler().switchAccess(player); } } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.ACCESS_SWITCH_ENTITY; + } } diff --git a/src/main/java/forestry/core/network/PacketAccessUpdate.java b/src/main/java/forestry/core/network/packets/PacketAccessUpdate.java similarity index 79% rename from src/main/java/forestry/core/network/PacketAccessUpdate.java rename to src/main/java/forestry/core/network/packets/PacketAccessUpdate.java index 37730f3a8..49872c493 100644 --- a/src/main/java/forestry/core/network/PacketAccessUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketAccessUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,10 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.access.IAccessHandler; import forestry.core.access.IRestrictedAccess; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; public class PacketAccessUpdate extends PacketCoordinates implements IForestryPacketClient { private IAccessHandler accessHandler; @@ -25,7 +29,7 @@ public class PacketAccessUpdate extends PacketCoordinates implements IForestryPa } public PacketAccessUpdate(IRestrictedAccess restrictedAccess, TileEntity tile) { - super(PacketIdClient.ACCESS_UPDATE, tile); + super(tile); accessHandler = restrictedAccess.getAccessHandler(); } @@ -44,4 +48,9 @@ public class PacketAccessUpdate extends PacketCoordinates implements IForestryPa restrictedAccessTile.getAccessHandler().readData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.ACCESS_UPDATE; + } } diff --git a/src/main/java/forestry/core/network/PacketAccessUpdateEntity.java b/src/main/java/forestry/core/network/packets/PacketAccessUpdateEntity.java similarity index 79% rename from src/main/java/forestry/core/network/PacketAccessUpdateEntity.java rename to src/main/java/forestry/core/network/packets/PacketAccessUpdateEntity.java index f3ec15856..4b458e0f3 100644 --- a/src/main/java/forestry/core/network/PacketAccessUpdateEntity.java +++ b/src/main/java/forestry/core/network/packets/PacketAccessUpdateEntity.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,10 @@ import net.minecraft.entity.player.EntityPlayer; import forestry.core.access.IAccessHandler; import forestry.core.access.IRestrictedAccess; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; public class PacketAccessUpdateEntity extends PacketEntityUpdate implements IForestryPacketClient { private IAccessHandler accessHandler; @@ -25,7 +29,7 @@ public class PacketAccessUpdateEntity extends PacketEntityUpdate implements IFor } public PacketAccessUpdateEntity(IRestrictedAccess restrictedAccess, Entity entity) { - super(PacketIdClient.ACCESS_UPDATE_ENTITY, entity); + super(entity); accessHandler = restrictedAccess.getAccessHandler(); } @@ -44,4 +48,9 @@ public class PacketAccessUpdateEntity extends PacketEntityUpdate implements IFor restrictedAccessTile.getAccessHandler().readData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.ACCESS_UPDATE_ENTITY; + } } diff --git a/src/main/java/forestry/core/network/PacketChipsetClick.java b/src/main/java/forestry/core/network/packets/PacketChipsetClick.java similarity index 80% rename from src/main/java/forestry/core/network/PacketChipsetClick.java rename to src/main/java/forestry/core/network/packets/PacketChipsetClick.java index b43f1268c..449d16082 100644 --- a/src/main/java/forestry/core/network/PacketChipsetClick.java +++ b/src/main/java/forestry/core/network/packets/PacketChipsetClick.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -18,6 +18,9 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.circuits.ItemCircuitBoard; import forestry.core.gui.IContainerSocketed; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; public class PacketChipsetClick extends PacketSlotClick implements IForestryPacketServer { @@ -25,7 +28,7 @@ public class PacketChipsetClick extends PacketSlotClick implements IForestryPack } public PacketChipsetClick(TileEntity tile, int slot) { - super(PacketIdServer.CHIPSET_CLICK, tile, slot); + super(tile, slot); } @Override @@ -40,4 +43,9 @@ public class PacketChipsetClick extends PacketSlotClick implements IForestryPack ((IContainerSocketed) player.openContainer).handleChipsetClickServer(getSlot(), player, itemstack); } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.CHIPSET_CLICK; + } } diff --git a/src/main/java/forestry/core/network/PacketCoordinates.java b/src/main/java/forestry/core/network/packets/PacketCoordinates.java old mode 100755 new mode 100644 similarity index 76% rename from src/main/java/forestry/core/network/PacketCoordinates.java rename to src/main/java/forestry/core/network/packets/PacketCoordinates.java index 3fbe30a99..3178628d5 --- a/src/main/java/forestry/core/network/PacketCoordinates.java +++ b/src/main/java/forestry/core/network/packets/PacketCoordinates.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.ForestryPacket; +import forestry.core.network.ILocatedPacket; + public abstract class PacketCoordinates extends ForestryPacket implements ILocatedPacket { private int posX; @@ -25,16 +30,15 @@ public abstract class PacketCoordinates extends ForestryPacket implements ILocat public PacketCoordinates() { } - protected PacketCoordinates(IPacketId id, TileEntity tileEntity) { - this(id, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + protected PacketCoordinates(TileEntity tileEntity) { + this(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); } - protected PacketCoordinates(IPacketId id, ChunkCoordinates coordinates) { - this(id, coordinates.posX, coordinates.posY, coordinates.posZ); + protected PacketCoordinates(ChunkCoordinates coordinates) { + this(coordinates.posX, coordinates.posY, coordinates.posZ); } - protected PacketCoordinates(IPacketId id, int posX, int posY, int posZ) { - super(id); + protected PacketCoordinates(int posX, int posY, int posZ) { this.posX = posX; this.posY = posY; this.posZ = posZ; diff --git a/src/main/java/forestry/core/network/PacketDummy.java b/src/main/java/forestry/core/network/packets/PacketDummy.java similarity index 58% rename from src/main/java/forestry/core/network/PacketDummy.java rename to src/main/java/forestry/core/network/packets/PacketDummy.java index 74ab05115..11af7fee1 100644 --- a/src/main/java/forestry/core/network/PacketDummy.java +++ b/src/main/java/forestry/core/network/packets/PacketDummy.java @@ -8,30 +8,17 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; - import cpw.mods.fml.common.network.internal.FMLProxyPacket; -public class PacketDummy implements IForestryPacketClient, IForestryPacketServer { +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacket; - public static final PacketDummy instance = new PacketDummy(); - - private PacketDummy() { - - } - - @Override - public void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException { - - } - - @Override - public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException { +public abstract class PacketDummy implements IForestryPacket { + protected PacketDummy() { } @@ -45,5 +32,4 @@ public class PacketDummy implements IForestryPacketClient, IForestryPacketServer return null; } - } diff --git a/src/main/java/forestry/core/network/packets/PacketDummyClient.java b/src/main/java/forestry/core/network/packets/PacketDummyClient.java new file mode 100644 index 000000000..42ba5ef85 --- /dev/null +++ b/src/main/java/forestry/core/network/packets/PacketDummyClient.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.network.packets; + +import java.io.IOException; + +import net.minecraft.entity.player.EntityPlayer; + +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; + +public class PacketDummyClient extends PacketDummy implements IForestryPacketClient { + public static final PacketDummyClient instance = new PacketDummyClient(); + + private PacketDummyClient() { + + } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.INVALID; + } + + @Override + public void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException { + + } +} diff --git a/src/main/java/forestry/core/network/packets/PacketDummyServer.java b/src/main/java/forestry/core/network/packets/PacketDummyServer.java new file mode 100644 index 000000000..4c4c86ed9 --- /dev/null +++ b/src/main/java/forestry/core/network/packets/PacketDummyServer.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.network.packets; + +import java.io.IOException; + +import net.minecraft.entity.player.EntityPlayerMP; + +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; + +public class PacketDummyServer extends PacketDummy implements IForestryPacketServer { + public static final PacketDummyServer instance = new PacketDummyServer(); + + private PacketDummyServer() { + + } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.INVALID; + } + + @Override + public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException { + + } +} diff --git a/src/main/java/forestry/core/network/PacketEntityUpdate.java b/src/main/java/forestry/core/network/packets/PacketEntityUpdate.java similarity index 81% rename from src/main/java/forestry/core/network/PacketEntityUpdate.java rename to src/main/java/forestry/core/network/packets/PacketEntityUpdate.java index 85acb8f51..0f3e11c25 100644 --- a/src/main/java/forestry/core/network/PacketEntityUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketEntityUpdate.java @@ -8,13 +8,18 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.entity.Entity; import net.minecraft.world.World; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.ForestryPacket; +import forestry.core.network.ILocatedPacket; + public abstract class PacketEntityUpdate extends ForestryPacket implements ILocatedPacket { // sending private Entity entity; @@ -24,8 +29,7 @@ public abstract class PacketEntityUpdate extends ForestryPacket implements ILoca public PacketEntityUpdate() { } - public PacketEntityUpdate(IPacketId id, Entity entity) { - super(id); + public PacketEntityUpdate(Entity entity) { this.entity = entity; } diff --git a/src/main/java/forestry/core/network/PacketErrorUpdate.java b/src/main/java/forestry/core/network/packets/PacketErrorUpdate.java similarity index 79% rename from src/main/java/forestry/core/network/PacketErrorUpdate.java rename to src/main/java/forestry/core/network/packets/PacketErrorUpdate.java index 87f008111..cac3a74d3 100644 --- a/src/main/java/forestry/core/network/PacketErrorUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketErrorUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,10 @@ import net.minecraft.tileentity.TileEntity; import forestry.api.core.IErrorLogic; import forestry.api.core.IErrorLogicSource; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketErrorUpdate extends PacketCoordinates implements IForestryPacketClient { @@ -27,7 +31,7 @@ public class PacketErrorUpdate extends PacketCoordinates implements IForestryPac } public PacketErrorUpdate(TileEntity tile, IErrorLogicSource errorLogicSource) { - super(PacketIdClient.ERROR_UPDATE, tile); + super(tile); this.errorLogic = errorLogicSource.getErrorLogic(); } @@ -46,4 +50,9 @@ public class PacketErrorUpdate extends PacketCoordinates implements IForestryPac errorLogic.readData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.ERROR_UPDATE; + } } diff --git a/src/main/java/forestry/core/network/PacketErrorUpdateEntity.java b/src/main/java/forestry/core/network/packets/PacketErrorUpdateEntity.java similarity index 79% rename from src/main/java/forestry/core/network/PacketErrorUpdateEntity.java rename to src/main/java/forestry/core/network/packets/PacketErrorUpdateEntity.java index 9ff701df6..93399c9a1 100644 --- a/src/main/java/forestry/core/network/PacketErrorUpdateEntity.java +++ b/src/main/java/forestry/core/network/packets/PacketErrorUpdateEntity.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,10 @@ import net.minecraft.entity.player.EntityPlayer; import forestry.api.core.IErrorLogic; import forestry.api.core.IErrorLogicSource; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketErrorUpdateEntity extends PacketEntityUpdate implements IForestryPacketClient { @@ -26,7 +30,7 @@ public class PacketErrorUpdateEntity extends PacketEntityUpdate implements IFore } public PacketErrorUpdateEntity(Entity entity, IErrorLogicSource errorLogicSource) { - super(PacketIdClient.ERROR_UPDATE_ENTITY, entity); + super(entity); this.errorLogic = errorLogicSource.getErrorLogic(); } @@ -45,4 +49,9 @@ public class PacketErrorUpdateEntity extends PacketEntityUpdate implements IFore errorLogic.readData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.ERROR_UPDATE_ENTITY; + } } diff --git a/src/main/java/forestry/core/network/PacketFXSignal.java b/src/main/java/forestry/core/network/packets/PacketFXSignal.java old mode 100755 new mode 100644 similarity index 90% rename from src/main/java/forestry/core/network/PacketFXSignal.java rename to src/main/java/forestry/core/network/packets/PacketFXSignal.java index 087b00305..ca7da9f7a --- a/src/main/java/forestry/core/network/PacketFXSignal.java +++ b/src/main/java/forestry/core/network/packets/PacketFXSignal.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,10 @@ import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.registry.GameData; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketFXSignal extends PacketCoordinates implements IForestryPacketClient { @@ -57,7 +61,7 @@ public class PacketFXSignal extends PacketCoordinates implements IForestryPacket } public PacketFXSignal(VisualFXType visualFX, SoundFXType soundFX, int xCoord, int yCoord, int zCoord, Block block, int meta) { - super(PacketIdClient.FX_SIGNAL, xCoord, yCoord, zCoord); + super(xCoord, yCoord, zCoord); this.visualFX = visualFX; this.soundFX = soundFX; this.block = block; @@ -97,4 +101,9 @@ public class PacketFXSignal extends PacketCoordinates implements IForestryPacket } } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.FX_SIGNAL; + } } diff --git a/src/main/java/forestry/core/network/PacketGenomeTrackerUpdate.java b/src/main/java/forestry/core/network/packets/PacketGenomeTrackerUpdate.java similarity index 82% rename from src/main/java/forestry/core/network/PacketGenomeTrackerUpdate.java rename to src/main/java/forestry/core/network/packets/PacketGenomeTrackerUpdate.java index f01093033..a2d203a20 100644 --- a/src/main/java/forestry/core/network/PacketGenomeTrackerUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketGenomeTrackerUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -22,6 +22,9 @@ import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IBreedingTracker; import forestry.api.genetics.ISpeciesRoot; import forestry.core.genetics.BreedingTracker; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketGenomeTrackerUpdate extends PacketNBT implements IForestryPacketClient { @@ -30,7 +33,7 @@ public class PacketGenomeTrackerUpdate extends PacketNBT implements IForestryPac } public PacketGenomeTrackerUpdate(NBTTagCompound nbtTagCompound) { - super(PacketIdClient.GENOME_TRACKER_UPDATE, nbtTagCompound); + super(nbtTagCompound); } @Override @@ -47,4 +50,9 @@ public class PacketGenomeTrackerUpdate extends PacketNBT implements IForestryPac MinecraftForge.EVENT_BUS.post(new ForestryEvent.SyncedBreedingTracker(tracker, player)); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.GENOME_TRACKER_UPDATE; + } } diff --git a/src/main/java/forestry/core/network/PacketGuiEnergy.java b/src/main/java/forestry/core/network/packets/PacketGuiEnergy.java similarity index 77% rename from src/main/java/forestry/core/network/PacketGuiEnergy.java rename to src/main/java/forestry/core/network/packets/PacketGuiEnergy.java index 0e4b0553b..ea3f37c42 100644 --- a/src/main/java/forestry/core/network/PacketGuiEnergy.java +++ b/src/main/java/forestry/core/network/packets/PacketGuiEnergy.java @@ -8,13 +8,18 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import forestry.core.gui.ContainerTile; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.ForestryPacket; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; public class PacketGuiEnergy extends ForestryPacket implements IForestryPacketClient { @@ -25,7 +30,6 @@ public class PacketGuiEnergy extends ForestryPacket implements IForestryPacketCl } public PacketGuiEnergy(int windowId, int value) { - super(PacketIdClient.GUI_ENERGY); this.windowId = windowId; this.value = value; } @@ -48,4 +52,9 @@ public class PacketGuiEnergy extends ForestryPacket implements IForestryPacketCl ((ContainerTile) player.openContainer).onGuiEnergy(value); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.GUI_ENERGY; + } } diff --git a/src/main/java/forestry/core/network/PacketGuiLayoutSelect.java b/src/main/java/forestry/core/network/packets/PacketGuiLayoutSelect.java similarity index 77% rename from src/main/java/forestry/core/network/PacketGuiLayoutSelect.java rename to src/main/java/forestry/core/network/packets/PacketGuiLayoutSelect.java index 24ac0cedd..d54205b90 100644 --- a/src/main/java/forestry/core/network/PacketGuiLayoutSelect.java +++ b/src/main/java/forestry/core/network/packets/PacketGuiLayoutSelect.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import forestry.core.circuits.ContainerSolderingIron; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; public class PacketGuiLayoutSelect extends PacketString implements IForestryPacketClient { @@ -23,7 +26,7 @@ public class PacketGuiLayoutSelect extends PacketString implements IForestryPack } public PacketGuiLayoutSelect(String string) { - super(PacketIdClient.GUI_LAYOUT_SELECT, string); + super(string); } @Override @@ -35,4 +38,9 @@ public class PacketGuiLayoutSelect extends PacketString implements IForestryPack ((ContainerSolderingIron) container).setLayout(getString()); } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.GUI_LAYOUT_SELECT; + } } diff --git a/src/main/java/forestry/core/network/PacketGuiSelect.java b/src/main/java/forestry/core/network/packets/PacketGuiSelect.java similarity index 81% rename from src/main/java/forestry/core/network/PacketGuiSelect.java rename to src/main/java/forestry/core/network/packets/PacketGuiSelect.java index 28eeaace4..ebff74529 100644 --- a/src/main/java/forestry/core/network/PacketGuiSelect.java +++ b/src/main/java/forestry/core/network/packets/PacketGuiSelect.java @@ -8,10 +8,14 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.ForestryPacket; + public abstract class PacketGuiSelect extends ForestryPacket { private int primaryIndex; private int secondaryIndex; @@ -19,8 +23,7 @@ public abstract class PacketGuiSelect extends ForestryPacket { protected PacketGuiSelect() { } - protected PacketGuiSelect(IPacketId id, int primaryIndex, int secondaryIndex) { - super(id); + protected PacketGuiSelect(int primaryIndex, int secondaryIndex) { this.primaryIndex = primaryIndex; this.secondaryIndex = secondaryIndex; } diff --git a/src/main/java/forestry/core/network/PacketGuiSelectRequest.java b/src/main/java/forestry/core/network/packets/PacketGuiSelectRequest.java similarity index 76% rename from src/main/java/forestry/core/network/PacketGuiSelectRequest.java rename to src/main/java/forestry/core/network/packets/PacketGuiSelectRequest.java index 08e89d494..fb3d97f17 100644 --- a/src/main/java/forestry/core/network/PacketGuiSelectRequest.java +++ b/src/main/java/forestry/core/network/packets/PacketGuiSelectRequest.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import forestry.core.gui.IGuiSelectable; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; public class PacketGuiSelectRequest extends PacketGuiSelect implements IForestryPacketServer { @@ -23,7 +26,7 @@ public class PacketGuiSelectRequest extends PacketGuiSelect implements IForestry } public PacketGuiSelectRequest(int primaryIndex, int secondaryIndex) { - super(PacketIdServer.GUI_SELECTION_REQUEST, primaryIndex, secondaryIndex); + super(primaryIndex, secondaryIndex); } @Override @@ -35,4 +38,9 @@ public class PacketGuiSelectRequest extends PacketGuiSelect implements IForestry ((IGuiSelectable) container).handleSelectionRequest(player, this); } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.GUI_SELECTION_REQUEST; + } } diff --git a/src/main/java/forestry/core/network/PacketGuiUpdate.java b/src/main/java/forestry/core/network/packets/PacketGuiUpdate.java similarity index 75% rename from src/main/java/forestry/core/network/PacketGuiUpdate.java rename to src/main/java/forestry/core/network/packets/PacketGuiUpdate.java index 8c8440613..c959dbdd2 100644 --- a/src/main/java/forestry/core/network/PacketGuiUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketGuiUpdate.java @@ -8,13 +8,18 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.IStreamableGui; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; import forestry.core.tiles.ILocatable; @@ -26,7 +31,7 @@ public class PacketGuiUpdate extends PacketCoordinates implements IForestryPacke } public PacketGuiUpdate(T guiDataTile) { - super(PacketIdClient.GUI_UPDATE, guiDataTile.getCoordinates()); + super(guiDataTile.getCoordinates()); this.guiDataTile = guiDataTile; } @@ -43,4 +48,9 @@ public class PacketGuiUpdate extends PacketCoordinates implements IForestryPacke ((IStreamableGui) tile).readGuiData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.GUI_UPDATE; + } } diff --git a/src/main/java/forestry/core/network/PacketGuiUpdateEntity.java b/src/main/java/forestry/core/network/packets/PacketGuiUpdateEntity.java similarity index 75% rename from src/main/java/forestry/core/network/PacketGuiUpdateEntity.java rename to src/main/java/forestry/core/network/packets/PacketGuiUpdateEntity.java index 33d618cbc..eb98948ee 100644 --- a/src/main/java/forestry/core/network/PacketGuiUpdateEntity.java +++ b/src/main/java/forestry/core/network/packets/PacketGuiUpdateEntity.java @@ -8,13 +8,18 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.IStreamableGui; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketGuiUpdateEntity extends PacketEntityUpdate implements IForestryPacketClient { @@ -24,7 +29,7 @@ public class PacketGuiUpdateEntity extends PacketEntityUpdate implements IForest } public PacketGuiUpdateEntity(IStreamableGui streamableGui, Entity entity) { - super(PacketIdClient.GUI_UPDATE_ENTITY, entity); + super(entity); this.streamableGui = streamableGui; } @@ -41,4 +46,9 @@ public class PacketGuiUpdateEntity extends PacketEntityUpdate implements IForest ((IStreamableGui) entity).readGuiData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.GUI_UPDATE_ENTITY; + } } diff --git a/src/main/java/forestry/core/network/PacketItemStackDisplay.java b/src/main/java/forestry/core/network/packets/PacketItemStackDisplay.java similarity index 80% rename from src/main/java/forestry/core/network/PacketItemStackDisplay.java rename to src/main/java/forestry/core/network/packets/PacketItemStackDisplay.java index 47828820a..51d81a0f0 100644 --- a/src/main/java/forestry/core/network/PacketItemStackDisplay.java +++ b/src/main/java/forestry/core/network/packets/PacketItemStackDisplay.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; import forestry.core.tiles.IItemStackDisplay; import forestry.core.tiles.TileForestry; @@ -28,7 +32,7 @@ public class PacketItemStackDisplay extends PacketCoordinates implements IForest } public PacketItemStackDisplay(T tile, ItemStack itemStack) { - super(PacketIdClient.ITEMSTACK_DISPLAY, tile); + super(tile); this.itemStack = itemStack; } @@ -51,4 +55,9 @@ public class PacketItemStackDisplay extends PacketCoordinates implements IForest ((IItemStackDisplay) tile).handleItemStackForDisplay(itemStack); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.ITEMSTACK_DISPLAY; + } } diff --git a/src/main/java/forestry/core/network/PacketNBT.java b/src/main/java/forestry/core/network/packets/PacketNBT.java old mode 100755 new mode 100644 similarity index 82% rename from src/main/java/forestry/core/network/PacketNBT.java rename to src/main/java/forestry/core/network/packets/PacketNBT.java index 48dc1cec7..6fd6652ff --- a/src/main/java/forestry/core/network/PacketNBT.java +++ b/src/main/java/forestry/core/network/packets/PacketNBT.java @@ -8,12 +8,16 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.nbt.NBTTagCompound; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.ForestryPacket; + public abstract class PacketNBT extends ForestryPacket { private NBTTagCompound nbttagcompound; @@ -21,8 +25,7 @@ public abstract class PacketNBT extends ForestryPacket { protected PacketNBT() { } - protected PacketNBT(IPacketId id, NBTTagCompound nbttagcompound) { - super(id); + protected PacketNBT(NBTTagCompound nbttagcompound) { this.nbttagcompound = nbttagcompound; } diff --git a/src/main/java/forestry/core/network/PacketPipetteClick.java b/src/main/java/forestry/core/network/packets/PacketPipetteClick.java similarity index 77% rename from src/main/java/forestry/core/network/PacketPipetteClick.java rename to src/main/java/forestry/core/network/packets/PacketPipetteClick.java index 508e738b8..0337d39d1 100644 --- a/src/main/java/forestry/core/network/PacketPipetteClick.java +++ b/src/main/java/forestry/core/network/packets/PacketPipetteClick.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -16,6 +16,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; import forestry.core.gui.IContainerLiquidTanks; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; public class PacketPipetteClick extends PacketSlotClick implements IForestryPacketServer { @@ -23,7 +26,7 @@ public class PacketPipetteClick extends PacketSlotClick implements IForestryPack } public PacketPipetteClick(TileEntity tile, int slot) { - super(PacketIdServer.PIPETTE_CLICK, tile, slot); + super(tile, slot); } @Override @@ -32,4 +35,9 @@ public class PacketPipetteClick extends PacketSlotClick implements IForestryPack ((IContainerLiquidTanks) player.openContainer).handlePipetteClick(getSlot(), player); } } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.PIPETTE_CLICK; + } } diff --git a/src/main/java/forestry/core/network/PacketSlotClick.java b/src/main/java/forestry/core/network/packets/PacketSlotClick.java similarity index 80% rename from src/main/java/forestry/core/network/PacketSlotClick.java rename to src/main/java/forestry/core/network/packets/PacketSlotClick.java index cb6d8a987..31a189648 100644 --- a/src/main/java/forestry/core/network/PacketSlotClick.java +++ b/src/main/java/forestry/core/network/packets/PacketSlotClick.java @@ -8,20 +8,23 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.tileentity.TileEntity; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; + public abstract class PacketSlotClick extends PacketCoordinates { private int slot; protected PacketSlotClick() { } - protected PacketSlotClick(IPacketId id, TileEntity tile, int slot) { - super(id, tile); + protected PacketSlotClick(TileEntity tile, int slot) { + super(tile); this.slot = slot; } diff --git a/src/main/java/forestry/core/network/PacketSocketUpdate.java b/src/main/java/forestry/core/network/packets/PacketSocketUpdate.java old mode 100755 new mode 100644 similarity index 84% rename from src/main/java/forestry/core/network/PacketSocketUpdate.java rename to src/main/java/forestry/core/network/packets/PacketSocketUpdate.java index 563cff086..85f0c37b5 --- a/src/main/java/forestry/core/network/PacketSocketUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketSocketUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import forestry.core.circuits.ISocketable; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketSocketUpdate extends PacketCoordinates implements IForestryPacketClient { @@ -27,7 +31,7 @@ public class PacketSocketUpdate extends PacketCoordinates implements IForestryPa } public PacketSocketUpdate(T tile) { - super(PacketIdClient.SOCKET_UPDATE, tile); + super(tile); itemStacks = new ItemStack[tile.getSocketCount()]; for (int i = 0; i < tile.getSocketCount(); i++) { @@ -59,4 +63,9 @@ public class PacketSocketUpdate extends PacketCoordinates implements IForestryPa socketable.setSocket(i, itemStacks[i]); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.SOCKET_UPDATE; + } } diff --git a/src/main/java/forestry/core/network/PacketSolderingIronClick.java b/src/main/java/forestry/core/network/packets/PacketSolderingIronClick.java similarity index 79% rename from src/main/java/forestry/core/network/PacketSolderingIronClick.java rename to src/main/java/forestry/core/network/packets/PacketSolderingIronClick.java index bc5505030..b8e50dcba 100644 --- a/src/main/java/forestry/core/network/PacketSolderingIronClick.java +++ b/src/main/java/forestry/core/network/packets/PacketSolderingIronClick.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -17,6 +17,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import forestry.core.gui.IContainerSocketed; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.IForestryPacketServer; +import forestry.core.network.PacketIdServer; public class PacketSolderingIronClick extends PacketSlotClick implements IForestryPacketServer { @@ -24,7 +27,7 @@ public class PacketSolderingIronClick extends PacketSlotClick implements IForest } public PacketSolderingIronClick(TileEntity tile, int slot) { - super(PacketIdServer.SOLDERING_IRON_CLICK, tile, slot); + super(tile, slot); } @Override @@ -36,4 +39,9 @@ public class PacketSolderingIronClick extends PacketSlotClick implements IForest ((IContainerSocketed) player.openContainer).handleSolderingIronClickServer(getSlot(), player, itemstack); } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.SOLDERING_IRON_CLICK; + } } diff --git a/src/main/java/forestry/core/network/PacketString.java b/src/main/java/forestry/core/network/packets/PacketString.java similarity index 79% rename from src/main/java/forestry/core/network/PacketString.java rename to src/main/java/forestry/core/network/packets/PacketString.java index 9abe915fe..c3a910d0f 100644 --- a/src/main/java/forestry/core/network/PacketString.java +++ b/src/main/java/forestry/core/network/packets/PacketString.java @@ -8,10 +8,14 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.ForestryPacket; + public abstract class PacketString extends ForestryPacket { private String string; @@ -19,8 +23,7 @@ public abstract class PacketString extends ForestryPacket { protected PacketString() { } - protected PacketString(IPacketId id, String string) { - super(id); + protected PacketString(String string) { this.string = string; } diff --git a/src/main/java/forestry/core/network/PacketTankLevelUpdate.java b/src/main/java/forestry/core/network/packets/PacketTankLevelUpdate.java similarity index 81% rename from src/main/java/forestry/core/network/PacketTankLevelUpdate.java rename to src/main/java/forestry/core/network/packets/PacketTankLevelUpdate.java index 2afe35e5b..2442e5b9c 100644 --- a/src/main/java/forestry/core/network/PacketTankLevelUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketTankLevelUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; @@ -18,6 +18,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fluids.FluidStack; import forestry.core.fluids.ITankManager; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; import forestry.core.tiles.ILiquidTankTile; @@ -30,7 +34,7 @@ public class PacketTankLevelUpdate extends PacketCoordinates implements IForestr } public PacketTankLevelUpdate(ILiquidTankTile tileEntity, int tankIndex, FluidStack contents) { - super(PacketIdClient.TANK_LEVEL_UPDATE, tileEntity.getCoordinates()); + super(tileEntity.getCoordinates()); this.tankIndex = tankIndex; this.contents = contents; } @@ -57,4 +61,9 @@ public class PacketTankLevelUpdate extends PacketCoordinates implements IForestr tankManager.processTankUpdate(tankIndex, contents); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.TANK_LEVEL_UPDATE; + } } diff --git a/src/main/java/forestry/core/network/PacketTileStream.java b/src/main/java/forestry/core/network/packets/PacketTileStream.java similarity index 77% rename from src/main/java/forestry/core/network/PacketTileStream.java rename to src/main/java/forestry/core/network/packets/PacketTileStream.java index 9c20b5112..9d7a9c084 100644 --- a/src/main/java/forestry/core/network/PacketTileStream.java +++ b/src/main/java/forestry/core/network/packets/PacketTileStream.java @@ -8,13 +8,18 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.network; +package forestry.core.network.packets; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import forestry.core.network.DataInputStreamForestry; +import forestry.core.network.DataOutputStreamForestry; +import forestry.core.network.IForestryPacketClient; +import forestry.core.network.IStreamable; +import forestry.core.network.PacketIdClient; import forestry.core.proxy.Proxies; public class PacketTileStream extends PacketCoordinates implements IForestryPacketClient { @@ -25,7 +30,7 @@ public class PacketTileStream extends PacketCoordinates implements IForestryPack } public PacketTileStream(T streamable) { - super(PacketIdClient.TILE_FORESTRY_UPDATE, streamable); + super(streamable); this.streamable = streamable; } @@ -42,4 +47,9 @@ public class PacketTileStream extends PacketCoordinates implements IForestryPack ((IStreamable) tile).readData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.TILE_FORESTRY_UPDATE; + } } diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index b1e010c5e..8d3af60e7 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -27,7 +27,7 @@ import cpw.mods.fml.common.Loader; import forestry.core.TickHandlerCoreServer; import forestry.core.multiblock.MultiblockServerTickHandler; -import forestry.core.network.PacketFXSignal; +import forestry.core.network.packets.PacketFXSignal; import forestry.core.worldgen.WorldGenerator; public class ProxyCommon { diff --git a/src/main/java/forestry/core/recipes/nei/CustomOverlayHandler.java b/src/main/java/forestry/core/recipes/nei/CustomOverlayHandler.java index 758ff6a78..ab3285e5b 100644 --- a/src/main/java/forestry/core/recipes/nei/CustomOverlayHandler.java +++ b/src/main/java/forestry/core/recipes/nei/CustomOverlayHandler.java @@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import forestry.core.proxy.Proxies; +import forestry.factory.network.packets.PacketWorktableNEISelect; import codechicken.nei.LayoutManager; import codechicken.nei.OffsetPositioner; diff --git a/src/main/java/forestry/core/tiles/TileAnalyzer.java b/src/main/java/forestry/core/tiles/TileAnalyzer.java index 03a84e6d5..ad3999512 100644 --- a/src/main/java/forestry/core/tiles/TileAnalyzer.java +++ b/src/main/java/forestry/core/tiles/TileAnalyzer.java @@ -39,7 +39,7 @@ import forestry.core.inventory.wrappers.InventoryMapper; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.GuiId; -import forestry.core.network.PacketItemStackDisplay; +import forestry.core.network.packets.PacketItemStackDisplay; import forestry.core.proxy.Proxies; import forestry.core.utils.GeneticsUtil; import forestry.core.utils.InventoryUtil; diff --git a/src/main/java/forestry/core/tiles/TileEngine.java b/src/main/java/forestry/core/tiles/TileEngine.java index f1ec2631a..fb239034a 100644 --- a/src/main/java/forestry/core/tiles/TileEngine.java +++ b/src/main/java/forestry/core/tiles/TileEngine.java @@ -21,7 +21,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import forestry.api.core.IErrorLogic; -import forestry.apiculture.network.PacketActiveUpdate; +import forestry.apiculture.network.packets.PacketActiveUpdate; import forestry.core.config.Config; import forestry.core.config.Constants; import forestry.core.errors.EnumErrorCode; diff --git a/src/main/java/forestry/core/tiles/TileForestry.java b/src/main/java/forestry/core/tiles/TileForestry.java index 46f5d72cf..2b65020ab 100644 --- a/src/main/java/forestry/core/tiles/TileForestry.java +++ b/src/main/java/forestry/core/tiles/TileForestry.java @@ -41,7 +41,7 @@ import forestry.core.inventory.IInventoryAdapter; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IStreamable; -import forestry.core.network.PacketTileStream; +import forestry.core.network.packets.PacketTileStream; import forestry.core.proxy.Proxies; import buildcraft.api.statements.IStatementContainer; diff --git a/src/main/java/forestry/energy/GuiHandlerEnergy.java b/src/main/java/forestry/energy/GuiHandlerEnergy.java index 736072e5b..3544d67ba 100755 --- a/src/main/java/forestry/energy/GuiHandlerEnergy.java +++ b/src/main/java/forestry/energy/GuiHandlerEnergy.java @@ -20,7 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.core.GuiHandlerBase; import forestry.core.network.GuiId; -import forestry.core.network.PacketSocketUpdate; +import forestry.core.network.packets.PacketSocketUpdate; import forestry.core.proxy.Proxies; import forestry.core.tiles.TileUtil; import forestry.energy.gui.ContainerEngineBiogas; diff --git a/src/main/java/forestry/factory/gui/ContainerCarpenter.java b/src/main/java/forestry/factory/gui/ContainerCarpenter.java index 4fa18041a..3ab09b7b1 100755 --- a/src/main/java/forestry/factory/gui/ContainerCarpenter.java +++ b/src/main/java/forestry/factory/gui/ContainerCarpenter.java @@ -21,7 +21,7 @@ import forestry.core.gui.slots.SlotCraftMatrix; import forestry.core.gui.slots.SlotFiltered; import forestry.core.gui.slots.SlotLocked; import forestry.core.gui.slots.SlotOutput; -import forestry.core.network.PacketItemStackDisplay; +import forestry.core.network.packets.PacketItemStackDisplay; import forestry.factory.inventory.InventoryCarpenter; import forestry.factory.tiles.TileCarpenter; diff --git a/src/main/java/forestry/factory/gui/ContainerWorktable.java b/src/main/java/forestry/factory/gui/ContainerWorktable.java index be73a9831..a15e63d1b 100755 --- a/src/main/java/forestry/factory/gui/ContainerWorktable.java +++ b/src/main/java/forestry/factory/gui/ContainerWorktable.java @@ -21,14 +21,14 @@ import forestry.core.gui.IContainerCrafting; import forestry.core.gui.IGuiSelectable; import forestry.core.gui.slots.SlotCraftMatrix; import forestry.core.gui.slots.SlotCrafter; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.core.utils.ItemStackUtil; import forestry.factory.inventory.InventoryCraftingForestry; import forestry.factory.inventory.InventoryGhostCrafting; import forestry.factory.inventory.InventoryWorktable; -import forestry.factory.network.PacketWorktableMemoryUpdate; -import forestry.factory.network.PacketWorktableRecipeUpdate; +import forestry.factory.network.packets.PacketWorktableMemoryUpdate; +import forestry.factory.network.packets.PacketWorktableRecipeUpdate; import forestry.factory.recipes.RecipeMemory; import forestry.factory.tiles.TileWorktable; diff --git a/src/main/java/forestry/factory/gui/GuiWorktable.java b/src/main/java/forestry/factory/gui/GuiWorktable.java index f90e77b69..44d4af42b 100755 --- a/src/main/java/forestry/factory/gui/GuiWorktable.java +++ b/src/main/java/forestry/factory/gui/GuiWorktable.java @@ -17,7 +17,7 @@ import forestry.core.config.Constants; import forestry.core.gui.GuiForestryTitled; import forestry.core.gui.buttons.GuiBetterButton; import forestry.core.gui.buttons.StandardButtonTextureSets; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.factory.gui.widgets.ClearWorktable; import forestry.factory.gui.widgets.MemorizedRecipeSlot; diff --git a/src/main/java/forestry/factory/network/PacketRegistryFactory.java b/src/main/java/forestry/factory/network/PacketRegistryFactory.java new file mode 100644 index 000000000..e88b97323 --- /dev/null +++ b/src/main/java/forestry/factory/network/PacketRegistryFactory.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.factory.network; + +import forestry.core.network.PacketRegistry; +import forestry.factory.network.packets.PacketWorktableMemoryUpdate; +import forestry.factory.network.packets.PacketWorktableNEISelect; +import forestry.factory.network.packets.PacketWorktableRecipeUpdate; + +public class PacketRegistryFactory extends PacketRegistry { + @Override + public void registerPackets() { + registerServerPacket(new PacketWorktableNEISelect()); + + registerClientPacket(new PacketWorktableMemoryUpdate()); + registerClientPacket(new PacketWorktableRecipeUpdate()); + } +} diff --git a/src/main/java/forestry/factory/network/PacketWorktableMemoryUpdate.java b/src/main/java/forestry/factory/network/packets/PacketWorktableMemoryUpdate.java similarity index 86% rename from src/main/java/forestry/factory/network/PacketWorktableMemoryUpdate.java rename to src/main/java/forestry/factory/network/packets/PacketWorktableMemoryUpdate.java index ef550d3ba..c71c0ed68 100644 --- a/src/main/java/forestry/factory/network/PacketWorktableMemoryUpdate.java +++ b/src/main/java/forestry/factory/network/packets/PacketWorktableMemoryUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.factory.network; +package forestry.factory.network.packets; import java.io.IOException; @@ -18,8 +18,8 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; import forestry.factory.recipes.RecipeMemory; import forestry.factory.tiles.TileWorktable; @@ -32,7 +32,7 @@ public class PacketWorktableMemoryUpdate extends PacketCoordinates implements IF } public PacketWorktableMemoryUpdate(TileWorktable worktable) { - super(PacketIdClient.WORKTABLE_MEMORY_UPDATE, worktable); + super(worktable); this.recipeMemory = worktable.getMemory(); } @@ -49,4 +49,9 @@ public class PacketWorktableMemoryUpdate extends PacketCoordinates implements IF ((TileWorktable) tile).getMemory().readData(data); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.WORKTABLE_MEMORY_UPDATE; + } } diff --git a/src/main/java/forestry/core/recipes/nei/PacketWorktableNEISelect.java b/src/main/java/forestry/factory/network/packets/PacketWorktableNEISelect.java similarity index 82% rename from src/main/java/forestry/core/recipes/nei/PacketWorktableNEISelect.java rename to src/main/java/forestry/factory/network/packets/PacketWorktableNEISelect.java index fab7e794d..653069e17 100644 --- a/src/main/java/forestry/core/recipes/nei/PacketWorktableNEISelect.java +++ b/src/main/java/forestry/factory/network/packets/PacketWorktableNEISelect.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.core.recipes.nei; +package forestry.factory.network.packets; import java.io.IOException; @@ -19,7 +19,8 @@ import forestry.core.gui.slots.SlotCraftMatrix; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.IForestryPacketServer; import forestry.core.network.PacketIdServer; -import forestry.core.network.PacketNBT; +import forestry.core.network.packets.PacketNBT; +import forestry.core.recipes.nei.SetRecipeCommandHandler; import forestry.factory.gui.ContainerWorktable; public class PacketWorktableNEISelect extends PacketNBT implements IForestryPacketServer { @@ -29,11 +30,16 @@ public class PacketWorktableNEISelect extends PacketNBT implements IForestryPack } public PacketWorktableNEISelect(NBTTagCompound nbttagcompound) { - super(PacketIdServer.WORKTABLE_NEI_SELECT, nbttagcompound); + super(nbttagcompound); } @Override public void onPacketData(DataInputStreamForestry data, EntityPlayerMP player) throws IOException { worktableNEISelectHandler.handle(getTagCompound(), player); } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.WORKTABLE_NEI_SELECT; + } } diff --git a/src/main/java/forestry/factory/network/PacketWorktableRecipeUpdate.java b/src/main/java/forestry/factory/network/packets/PacketWorktableRecipeUpdate.java similarity index 87% rename from src/main/java/forestry/factory/network/PacketWorktableRecipeUpdate.java rename to src/main/java/forestry/factory/network/packets/PacketWorktableRecipeUpdate.java index 0cfd75685..e36437694 100644 --- a/src/main/java/forestry/factory/network/PacketWorktableRecipeUpdate.java +++ b/src/main/java/forestry/factory/network/packets/PacketWorktableRecipeUpdate.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.factory.network; +package forestry.factory.network.packets; import java.io.IOException; @@ -18,8 +18,8 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.core.proxy.Proxies; import forestry.factory.recipes.MemorizedRecipe; import forestry.factory.tiles.TileWorktable; @@ -34,7 +34,7 @@ public class PacketWorktableRecipeUpdate extends PacketCoordinates implements IF } public PacketWorktableRecipeUpdate(TileWorktable worktable) { - super(PacketIdClient.WORKTABLE_CRAFTING_UPDATE, worktable); + super(worktable); this.recipe = worktable.getCurrentRecipe(); } @@ -57,4 +57,9 @@ public class PacketWorktableRecipeUpdate extends PacketCoordinates implements IF ((TileWorktable) tile).setCurrentRecipe(recipe); } } + + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.WORKTABLE_CRAFTING_UPDATE; + } } diff --git a/src/main/java/forestry/farming/GuiHandlerFarming.java b/src/main/java/forestry/farming/GuiHandlerFarming.java index 4c8bba931..a38a25845 100755 --- a/src/main/java/forestry/farming/GuiHandlerFarming.java +++ b/src/main/java/forestry/farming/GuiHandlerFarming.java @@ -20,7 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.core.GuiHandlerBase; import forestry.core.network.GuiId; -import forestry.core.network.PacketSocketUpdate; +import forestry.core.network.packets.PacketSocketUpdate; import forestry.core.proxy.Proxies; import forestry.core.tiles.TileUtil; import forestry.farming.gui.ContainerFarm; diff --git a/src/main/java/forestry/farming/gui/ContainerFarm.java b/src/main/java/forestry/farming/gui/ContainerFarm.java index 983ab9207..fcdd49851 100755 --- a/src/main/java/forestry/farming/gui/ContainerFarm.java +++ b/src/main/java/forestry/farming/gui/ContainerFarm.java @@ -17,7 +17,7 @@ import net.minecraftforge.fluids.IFluidTank; import forestry.core.gui.ContainerSocketed; import forestry.core.gui.slots.SlotFiltered; import forestry.core.gui.slots.SlotOutput; -import forestry.core.network.PacketGuiUpdate; +import forestry.core.network.packets.PacketGuiUpdate; import forestry.farming.multiblock.InventoryFarm; import forestry.farming.tiles.TileFarm; diff --git a/src/main/java/forestry/farming/logic/CropFruit.java b/src/main/java/forestry/farming/logic/CropFruit.java index f78afafca..d878eb7e5 100755 --- a/src/main/java/forestry/farming/logic/CropFruit.java +++ b/src/main/java/forestry/farming/logic/CropFruit.java @@ -18,7 +18,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import forestry.api.genetics.IFruitBearer; -import forestry.core.network.PacketFXSignal; +import forestry.core.network.packets.PacketFXSignal; import forestry.core.proxy.Proxies; import forestry.core.utils.vect.Vect; diff --git a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java index 68bbdb5cd..28beacb47 100755 --- a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java +++ b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java @@ -36,7 +36,7 @@ import forestry.api.lepidopterology.IButterfly; import forestry.api.lepidopterology.IButterflyNursery; import forestry.core.config.Config; import forestry.core.genetics.ItemGE; -import forestry.core.network.PacketFXSignal; +import forestry.core.network.packets.PacketFXSignal; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; import forestry.core.utils.EntityUtil; diff --git a/src/main/java/forestry/mail/PostRegistry.java b/src/main/java/forestry/mail/PostRegistry.java index 7655bd388..c040fb37f 100755 --- a/src/main/java/forestry/mail/PostRegistry.java +++ b/src/main/java/forestry/mail/PostRegistry.java @@ -33,7 +33,7 @@ import forestry.api.mail.PostManager; import forestry.core.config.ForestryItem; import forestry.core.proxy.Proxies; import forestry.core.utils.PlayerUtil; -import forestry.mail.network.PacketPOBoxInfoResponse; +import forestry.mail.network.packets.PacketPOBoxInfoResponse; public class PostRegistry implements IPostRegistry { diff --git a/src/main/java/forestry/mail/PostalCarrier.java b/src/main/java/forestry/mail/PostalCarrier.java index 923f4e4d3..3dff7662d 100755 --- a/src/main/java/forestry/mail/PostalCarrier.java +++ b/src/main/java/forestry/mail/PostalCarrier.java @@ -30,7 +30,7 @@ import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; import forestry.core.utils.PlayerUtil; import forestry.core.utils.StringUtil; -import forestry.mail.network.PacketPOBoxInfoResponse; +import forestry.mail.network.packets.PacketPOBoxInfoResponse; public class PostalCarrier implements IPostalCarrier { diff --git a/src/main/java/forestry/mail/TickHandlerMailClient.java b/src/main/java/forestry/mail/TickHandlerMailClient.java index d0585f820..ac560722d 100755 --- a/src/main/java/forestry/mail/TickHandlerMailClient.java +++ b/src/main/java/forestry/mail/TickHandlerMailClient.java @@ -16,7 +16,7 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase; import forestry.core.proxy.Proxies; import forestry.mail.gui.GuiMailboxInfo; -import forestry.mail.network.PacketPOBoxInfoRequest; +import forestry.mail.network.packets.PacketPOBoxInfoRequest; public class TickHandlerMailClient { private static final int THROTTLE_TIME_MS = 10000; diff --git a/src/main/java/forestry/mail/gui/ContainerCatalogue.java b/src/main/java/forestry/mail/gui/ContainerCatalogue.java index 1fa8a453a..4b49c5b96 100755 --- a/src/main/java/forestry/mail/gui/ContainerCatalogue.java +++ b/src/main/java/forestry/mail/gui/ContainerCatalogue.java @@ -30,10 +30,10 @@ import forestry.api.mail.ITradeStation; import forestry.api.mail.PostManager; import forestry.api.mail.TradeStationInfo; import forestry.core.gui.IGuiSelectable; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.core.proxy.Proxies; import forestry.mail.EnumStationState; -import forestry.mail.network.PacketLetterInfoResponse; +import forestry.mail.network.packets.PacketLetterInfoResponse; public class ContainerCatalogue extends Container implements IGuiSelectable, ILetterInfoReceiver { diff --git a/src/main/java/forestry/mail/gui/ContainerLetter.java b/src/main/java/forestry/mail/gui/ContainerLetter.java index 2a67032f3..24a0c1380 100755 --- a/src/main/java/forestry/mail/gui/ContainerLetter.java +++ b/src/main/java/forestry/mail/gui/ContainerLetter.java @@ -28,12 +28,12 @@ import forestry.api.mail.PostManager; import forestry.api.mail.TradeStationInfo; import forestry.core.gui.ContainerItemInventory; import forestry.core.gui.slots.SlotFiltered; -import forestry.core.network.PacketString; +import forestry.core.network.packets.PacketString; import forestry.core.proxy.Proxies; import forestry.mail.Letter; import forestry.mail.inventory.ItemInventoryLetter; -import forestry.mail.network.PacketLetterInfoResponse; -import forestry.mail.network.PacketLetterTextSet; +import forestry.mail.network.packets.PacketLetterInfoResponse; +import forestry.mail.network.packets.PacketLetterTextSet; public class ContainerLetter extends ContainerItemInventory implements ILetterInfoReceiver { diff --git a/src/main/java/forestry/mail/gui/ContainerMailbox.java b/src/main/java/forestry/mail/gui/ContainerMailbox.java index d5675ce19..9e78508ee 100755 --- a/src/main/java/forestry/mail/gui/ContainerMailbox.java +++ b/src/main/java/forestry/mail/gui/ContainerMailbox.java @@ -21,7 +21,7 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.SlotUtil; import forestry.mail.POBox; import forestry.mail.POBoxInfo; -import forestry.mail.network.PacketPOBoxInfoResponse; +import forestry.mail.network.packets.PacketPOBoxInfoResponse; import forestry.mail.tiles.TileMailbox; public class ContainerMailbox extends ContainerTile { diff --git a/src/main/java/forestry/mail/gui/GuiLetter.java b/src/main/java/forestry/mail/gui/GuiLetter.java index ccec70a94..39fe84575 100755 --- a/src/main/java/forestry/mail/gui/GuiLetter.java +++ b/src/main/java/forestry/mail/gui/GuiLetter.java @@ -18,7 +18,6 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.EntityPlayer; import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; import forestry.api.mail.EnumAddressee; import forestry.api.mail.IMailAddress; @@ -32,7 +31,7 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.StringUtil; import forestry.mail.gui.widgets.AddresseeSlot; import forestry.mail.inventory.ItemInventoryLetter; -import forestry.mail.network.PacketLetterInfoRequest; +import forestry.mail.network.packets.PacketLetterInfoRequest; public class GuiLetter extends GuiForestry { diff --git a/src/main/java/forestry/mail/gui/GuiTradeName.java b/src/main/java/forestry/mail/gui/GuiTradeName.java index 271c508e6..1cd501bc5 100755 --- a/src/main/java/forestry/mail/gui/GuiTradeName.java +++ b/src/main/java/forestry/mail/gui/GuiTradeName.java @@ -20,7 +20,7 @@ import forestry.core.config.Constants; import forestry.core.gui.GuiForestry; import forestry.core.proxy.Proxies; import forestry.core.utils.StringUtil; -import forestry.mail.network.PacketTraderAddressRequest; +import forestry.mail.network.packets.PacketTraderAddressRequest; import forestry.mail.tiles.TileTrader; public class GuiTradeName extends GuiForestry { diff --git a/src/main/java/forestry/mail/gui/ILetterInfoReceiver.java b/src/main/java/forestry/mail/gui/ILetterInfoReceiver.java index 7eb0b928e..b9eb41ef2 100644 --- a/src/main/java/forestry/mail/gui/ILetterInfoReceiver.java +++ b/src/main/java/forestry/mail/gui/ILetterInfoReceiver.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.mail.gui; -import forestry.mail.network.PacketLetterInfoResponse; +import forestry.mail.network.packets.PacketLetterInfoResponse; public interface ILetterInfoReceiver { void handleLetterInfoUpdate(PacketLetterInfoResponse packet); diff --git a/src/main/java/forestry/mail/network/PacketRegistryMail.java b/src/main/java/forestry/mail/network/PacketRegistryMail.java new file mode 100644 index 000000000..350067895 --- /dev/null +++ b/src/main/java/forestry/mail/network/PacketRegistryMail.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.mail.network; + +import forestry.core.network.PacketRegistry; +import forestry.mail.network.packets.PacketLetterInfoRequest; +import forestry.mail.network.packets.PacketLetterInfoResponse; +import forestry.mail.network.packets.PacketLetterTextSet; +import forestry.mail.network.packets.PacketPOBoxInfoRequest; +import forestry.mail.network.packets.PacketPOBoxInfoResponse; +import forestry.mail.network.packets.PacketTraderAddressRequest; +import forestry.mail.network.packets.PacketTraderAddressResponse; + +public class PacketRegistryMail extends PacketRegistry { + @Override + public void registerPackets() { + registerServerPacket(new PacketLetterInfoRequest()); + registerServerPacket(new PacketTraderAddressRequest()); + registerServerPacket(new PacketPOBoxInfoRequest()); + registerServerPacket(new PacketLetterTextSet()); + + registerClientPacket(new PacketLetterInfoResponse()); + registerClientPacket(new PacketTraderAddressResponse()); + registerClientPacket(new PacketPOBoxInfoResponse()); + } +} diff --git a/src/main/java/forestry/mail/network/PacketLetterInfoRequest.java b/src/main/java/forestry/mail/network/packets/PacketLetterInfoRequest.java similarity index 90% rename from src/main/java/forestry/mail/network/PacketLetterInfoRequest.java rename to src/main/java/forestry/mail/network/packets/PacketLetterInfoRequest.java index 1d3f8b474..59c616b04 100644 --- a/src/main/java/forestry/mail/network/PacketLetterInfoRequest.java +++ b/src/main/java/forestry/mail/network/packets/PacketLetterInfoRequest.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; @@ -31,7 +31,6 @@ public class PacketLetterInfoRequest extends ForestryPacket implements IForestry } public PacketLetterInfoRequest(String recipientName, EnumAddressee addressType) { - super(PacketIdServer.LETTER_INFO_REQUEST); this.recipientName = recipientName; this.addressType = addressType; } @@ -58,4 +57,9 @@ public class PacketLetterInfoRequest extends ForestryPacket implements IForestry ((ContainerLetter) player.openContainer).handleRequestLetterInfo(player, recipientName, addressType); } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.LETTER_INFO_REQUEST; + } } diff --git a/src/main/java/forestry/mail/network/PacketLetterInfoResponse.java b/src/main/java/forestry/mail/network/packets/PacketLetterInfoResponse.java similarity index 96% rename from src/main/java/forestry/mail/network/PacketLetterInfoResponse.java rename to src/main/java/forestry/mail/network/packets/PacketLetterInfoResponse.java index 9d5df0004..455380d2f 100644 --- a/src/main/java/forestry/mail/network/PacketLetterInfoResponse.java +++ b/src/main/java/forestry/mail/network/packets/PacketLetterInfoResponse.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; import java.util.UUID; @@ -41,7 +41,6 @@ public class PacketLetterInfoResponse extends ForestryPacket implements IForestr } public PacketLetterInfoResponse(EnumAddressee type, TradeStationInfo info, IMailAddress address) { - super(PacketIdClient.LETTER_INFO_RESPONSE); this.type = type; if (type == EnumAddressee.TRADER) { this.tradeInfo = info; @@ -50,6 +49,11 @@ public class PacketLetterInfoResponse extends ForestryPacket implements IForestr } } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.LETTER_INFO_RESPONSE; + } + @Override public void writeData(DataOutputStreamForestry data) throws IOException { diff --git a/src/main/java/forestry/mail/network/PacketLetterTextSet.java b/src/main/java/forestry/mail/network/packets/PacketLetterTextSet.java similarity index 83% rename from src/main/java/forestry/mail/network/PacketLetterTextSet.java rename to src/main/java/forestry/mail/network/packets/PacketLetterTextSet.java index 00e3ead17..ee6804259 100644 --- a/src/main/java/forestry/mail/network/PacketLetterTextSet.java +++ b/src/main/java/forestry/mail/network/packets/PacketLetterTextSet.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; @@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.IForestryPacketServer; import forestry.core.network.PacketIdServer; -import forestry.core.network.PacketString; +import forestry.core.network.packets.PacketString; import forestry.mail.gui.ContainerLetter; public class PacketLetterTextSet extends PacketString implements IForestryPacketServer { @@ -26,7 +26,12 @@ public class PacketLetterTextSet extends PacketString implements IForestryPacket } public PacketLetterTextSet(String string) { - super(PacketIdServer.LETTER_TEXT_SET, string); + super(string); + } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.LETTER_TEXT_SET; } @Override diff --git a/src/main/java/forestry/mail/network/PacketPOBoxInfoRequest.java b/src/main/java/forestry/mail/network/packets/PacketPOBoxInfoRequest.java similarity index 89% rename from src/main/java/forestry/mail/network/PacketPOBoxInfoRequest.java rename to src/main/java/forestry/mail/network/packets/PacketPOBoxInfoRequest.java index 6fb0a52b2..b68f643de 100644 --- a/src/main/java/forestry/mail/network/PacketPOBoxInfoRequest.java +++ b/src/main/java/forestry/mail/network/packets/PacketPOBoxInfoRequest.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; @@ -26,7 +26,11 @@ import forestry.mail.PostRegistry; public class PacketPOBoxInfoRequest extends ForestryPacket implements IForestryPacketServer { public PacketPOBoxInfoRequest() { - super(PacketIdServer.POBOX_INFO_REQUEST); + } + + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.POBOX_INFO_REQUEST; } @Override diff --git a/src/main/java/forestry/mail/network/PacketPOBoxInfoResponse.java b/src/main/java/forestry/mail/network/packets/PacketPOBoxInfoResponse.java similarity index 93% rename from src/main/java/forestry/mail/network/PacketPOBoxInfoResponse.java rename to src/main/java/forestry/mail/network/packets/PacketPOBoxInfoResponse.java index 72478667e..8b3f9e1ce 100644 --- a/src/main/java/forestry/mail/network/PacketPOBoxInfoResponse.java +++ b/src/main/java/forestry/mail/network/packets/PacketPOBoxInfoResponse.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; @@ -30,10 +30,14 @@ public class PacketPOBoxInfoResponse extends ForestryPacket implements IForestry } public PacketPOBoxInfoResponse(POBoxInfo info) { - super(PacketIdClient.POBOX_INFO_RESPONSE); this.poboxInfo = info; } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.POBOX_INFO_RESPONSE; + } + @Override protected void writeData(DataOutputStreamForestry data) throws IOException { if (poboxInfo == null) { diff --git a/src/main/java/forestry/mail/network/PacketTraderAddressRequest.java b/src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java similarity index 86% rename from src/main/java/forestry/mail/network/PacketTraderAddressRequest.java rename to src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java index 87545133c..bc3dfe752 100644 --- a/src/main/java/forestry/mail/network/PacketTraderAddressRequest.java +++ b/src/main/java/forestry/mail/network/packets/PacketTraderAddressRequest.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; @@ -18,8 +18,8 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketServer; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdServer; +import forestry.core.network.packets.PacketCoordinates; import forestry.mail.tiles.TileTrader; public class PacketTraderAddressRequest extends PacketCoordinates implements IForestryPacketServer { @@ -30,10 +30,15 @@ public class PacketTraderAddressRequest extends PacketCoordinates implements IFo } public PacketTraderAddressRequest(TileTrader tile, String addressName) { - super(PacketIdServer.TRADING_ADDRESS_REQUEST, tile); + super(tile); this.addressName = addressName; } + @Override + public PacketIdServer getPacketId() { + return PacketIdServer.TRADING_ADDRESS_REQUEST; + } + @Override protected void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/mail/network/PacketTraderAddressResponse.java b/src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java similarity index 86% rename from src/main/java/forestry/mail/network/PacketTraderAddressResponse.java rename to src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java index beace32c3..28e4d4316 100644 --- a/src/main/java/forestry/mail/network/PacketTraderAddressResponse.java +++ b/src/main/java/forestry/mail/network/packets/PacketTraderAddressResponse.java @@ -8,7 +8,7 @@ * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ -package forestry.mail.network; +package forestry.mail.network.packets; import java.io.IOException; @@ -18,8 +18,8 @@ import net.minecraft.tileentity.TileEntity; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; import forestry.core.network.IForestryPacketClient; -import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketIdClient; +import forestry.core.network.packets.PacketCoordinates; import forestry.mail.tiles.TileTrader; public class PacketTraderAddressResponse extends PacketCoordinates implements IForestryPacketClient { @@ -30,10 +30,15 @@ public class PacketTraderAddressResponse extends PacketCoordinates implements IF } public PacketTraderAddressResponse(TileTrader tile, String addressName) { - super(PacketIdClient.TRADING_ADDRESS_RESPONSE, tile); + super(tile); this.addressName = addressName; } + @Override + public PacketIdClient getPacketId() { + return PacketIdClient.TRADING_ADDRESS_RESPONSE; + } + @Override protected void writeData(DataOutputStreamForestry data) throws IOException { super.writeData(data); diff --git a/src/main/java/forestry/mail/tiles/TileTrader.java b/src/main/java/forestry/mail/tiles/TileTrader.java index c62291df2..25af2f975 100644 --- a/src/main/java/forestry/mail/tiles/TileTrader.java +++ b/src/main/java/forestry/mail/tiles/TileTrader.java @@ -41,7 +41,7 @@ import forestry.core.utils.ItemStackUtil; import forestry.mail.MailAddress; import forestry.mail.TradeStation; import forestry.mail.inventory.InventoryTradeStation; -import forestry.mail.network.PacketTraderAddressResponse; +import forestry.mail.network.packets.PacketTraderAddressResponse; import forestry.mail.triggers.MailTriggers; import buildcraft.api.statements.ITriggerExternal; diff --git a/src/main/java/forestry/plugins/ForestryPlugin.java b/src/main/java/forestry/plugins/ForestryPlugin.java index f38a55d99..53f5bd888 100755 --- a/src/main/java/forestry/plugins/ForestryPlugin.java +++ b/src/main/java/forestry/plugins/ForestryPlugin.java @@ -24,6 +24,8 @@ import forestry.core.GuiHandlerBase; import forestry.core.IPickupHandler; import forestry.core.IResupplyHandler; import forestry.core.ISaveEventHandler; +import forestry.core.network.IPacketRegistry; +import forestry.core.network.PacketRegistryDummy; import forestry.core.utils.Log; public abstract class ForestryPlugin { @@ -108,8 +110,8 @@ public abstract class ForestryPlugin { public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) { } - public void registerPacketHandlers() { - + public IPacketRegistry getPacketRegistry() { + return PacketRegistryDummy.instance; } public IPickupHandler getPickupHandler() { diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index 404088451..8c0eca612 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -102,13 +102,7 @@ import forestry.apiculture.multiblock.TileAlvearyPlain; import forestry.apiculture.multiblock.TileAlvearySieve; import forestry.apiculture.multiblock.TileAlvearyStabiliser; import forestry.apiculture.multiblock.TileAlvearySwarmer; -import forestry.apiculture.network.PacketActiveUpdate; -import forestry.apiculture.network.PacketBeeLogicActive; -import forestry.apiculture.network.PacketBeeLogicActiveEntity; -import forestry.apiculture.network.PacketBeeLogicEntityRequest; -import forestry.apiculture.network.PacketCandleUpdate; -import forestry.apiculture.network.PacketHabitatBiomePointer; -import forestry.apiculture.network.PacketImprintSelectionResponse; +import forestry.apiculture.network.PacketRegistryApiculture; import forestry.apiculture.proxy.ProxyApiculture; import forestry.apiculture.tiles.TileApiaristChest; import forestry.apiculture.tiles.TileApiary; @@ -137,8 +131,7 @@ import forestry.core.items.ItemOverlay.OverlayInfo; import forestry.core.items.ItemScoop; import forestry.core.items.ItemWithGui; import forestry.core.network.GuiId; -import forestry.core.network.PacketIdClient; -import forestry.core.network.PacketIdServer; +import forestry.core.network.IPacketRegistry; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; import forestry.core.recipes.ShapedRecipeCustom; @@ -520,15 +513,8 @@ public class PluginApiculture extends ForestryPlugin { } @Override - public void registerPacketHandlers() { - PacketIdClient.IMPRINT_SELECTION_RESPONSE.setPacketHandler(new PacketImprintSelectionResponse()); - PacketIdClient.TILE_FORESTRY_ACTIVE.setPacketHandler(new PacketActiveUpdate()); - PacketIdClient.BEE_LOGIC_ACTIVE.setPacketHandler(new PacketBeeLogicActive()); - PacketIdClient.BEE_LOGIC_ACTIVE_ENTITY.setPacketHandler(new PacketBeeLogicActiveEntity()); - PacketIdClient.HABITAT_BIOME_POINTER.setPacketHandler(new PacketHabitatBiomePointer()); - PacketIdClient.CANDLE_UPDATE.setPacketHandler(new PacketCandleUpdate()); - - PacketIdServer.BEE_LOGIC_ACTIVE_ENTITY_REQUEST.setPacketHandler(new PacketBeeLogicEntityRequest()); + public IPacketRegistry getPacketRegistry() { + return new PacketRegistryApiculture(); } @Override diff --git a/src/main/java/forestry/plugins/PluginArboriculture.java b/src/main/java/forestry/plugins/PluginArboriculture.java index af8baa944..2aedcb218 100644 --- a/src/main/java/forestry/plugins/PluginArboriculture.java +++ b/src/main/java/forestry/plugins/PluginArboriculture.java @@ -65,7 +65,7 @@ import forestry.arboriculture.items.ItemBlockLeaves; import forestry.arboriculture.items.ItemBlockWood; import forestry.arboriculture.items.ItemGermlingGE; import forestry.arboriculture.items.ItemGrafter; -import forestry.arboriculture.network.PacketRipeningUpdate; +import forestry.arboriculture.network.PacketRegistryArboriculture; import forestry.arboriculture.proxy.ProxyArboriculture; import forestry.arboriculture.tiles.TileArboristChest; import forestry.arboriculture.tiles.TileFruitPod; @@ -84,7 +84,7 @@ import forestry.core.items.ItemBlockForestry; import forestry.core.items.ItemFruit.EnumFruit; import forestry.core.items.ItemWithGui; import forestry.core.network.GuiId; -import forestry.core.network.PacketIdClient; +import forestry.core.network.IPacketRegistry; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; import forestry.core.recipes.ShapedRecipeCustom; @@ -432,8 +432,8 @@ public class PluginArboriculture extends ForestryPlugin { } @Override - public void registerPacketHandlers() { - PacketIdClient.RIPENING_UPDATE.setPacketHandler(new PacketRipeningUpdate()); + public IPacketRegistry getPacketRegistry() { + return new PacketRegistryArboriculture(); } @Override diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java index ceec137c7..7492980eb 100644 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -69,10 +69,11 @@ import forestry.core.items.ItemMisc; import forestry.core.items.ItemOverlay.OverlayInfo; import forestry.core.items.ItemPipette; import forestry.core.items.ItemSolderingIron; -import forestry.core.items.ItemWithGui; import forestry.core.items.ItemWrench; import forestry.core.multiblock.MultiblockLogicFactory; import forestry.core.network.GuiId; +import forestry.core.network.IPacketRegistry; +import forestry.core.network.PacketRegistryCore; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; import forestry.core.recipes.ShapedRecipeCustom; @@ -451,6 +452,11 @@ public class PluginCore extends ForestryPlugin { RecipeUtil.addShapelessRecipe(ForestryItem.ingotBronze.getItemStack(9), "blockBronze"); } + @Override + public IPacketRegistry getPacketRegistry() { + return new PacketRegistryCore(); + } + @Override public IPickupHandler getPickupHandler() { return new PickupHandlerCore(); diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index 78d5ccb21..017163956 100644 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -43,13 +43,11 @@ import forestry.core.config.ForestryItem; import forestry.core.fluids.Fluids; import forestry.core.items.ItemBlockForestry; import forestry.core.items.ItemBlockNBT; -import forestry.core.network.PacketIdClient; -import forestry.core.network.PacketIdServer; +import forestry.core.network.IPacketRegistry; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.recipes.craftguide.CraftGuideIntegration; -import forestry.core.recipes.nei.PacketWorktableNEISelect; import forestry.core.tiles.MachineDefinition; import forestry.core.utils.Log; import forestry.core.utils.ModUtil; @@ -58,8 +56,7 @@ import forestry.core.utils.datastructures.ItemStackMap; import forestry.factory.DummyManagers; import forestry.factory.GuiHandlerFactory; import forestry.factory.circuits.CircuitSpeedUpgrade; -import forestry.factory.network.PacketWorktableMemoryUpdate; -import forestry.factory.network.PacketWorktableRecipeUpdate; +import forestry.factory.network.PacketRegistryFactory; import forestry.factory.recipes.CarpenterRecipeManager; import forestry.factory.recipes.CentrifugeRecipeManager; import forestry.factory.recipes.FabricatorRecipeManager; @@ -150,11 +147,8 @@ public class PluginFactory extends ForestryPlugin { } @Override - public void registerPacketHandlers() { - PacketIdServer.WORKTABLE_NEI_SELECT.setPacketHandler(new PacketWorktableNEISelect()); - - PacketIdClient.WORKTABLE_MEMORY_UPDATE.setPacketHandler(new PacketWorktableMemoryUpdate()); - PacketIdClient.WORKTABLE_CRAFTING_UPDATE.setPacketHandler(new PacketWorktableRecipeUpdate()); + public IPacketRegistry getPacketRegistry() { + return new PacketRegistryFactory(); } @Override diff --git a/src/main/java/forestry/plugins/PluginMail.java b/src/main/java/forestry/plugins/PluginMail.java index ed01a4604..6d55d4d1f 100755 --- a/src/main/java/forestry/plugins/PluginMail.java +++ b/src/main/java/forestry/plugins/PluginMail.java @@ -34,8 +34,7 @@ import forestry.core.fluids.Fluids; import forestry.core.items.ItemBlockForestry; import forestry.core.items.ItemWithGui; import forestry.core.network.GuiId; -import forestry.core.network.PacketIdClient; -import forestry.core.network.PacketIdServer; +import forestry.core.network.IPacketRegistry; import forestry.core.recipes.RecipeUtil; import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.tiles.MachineDefinition; @@ -48,13 +47,7 @@ import forestry.mail.commands.CommandMail; import forestry.mail.items.ItemLetter; import forestry.mail.items.ItemStamps; import forestry.mail.items.ItemStamps.StampInfo; -import forestry.mail.network.PacketLetterInfoRequest; -import forestry.mail.network.PacketLetterInfoResponse; -import forestry.mail.network.PacketLetterTextSet; -import forestry.mail.network.PacketPOBoxInfoRequest; -import forestry.mail.network.PacketPOBoxInfoResponse; -import forestry.mail.network.PacketTraderAddressRequest; -import forestry.mail.network.PacketTraderAddressResponse; +import forestry.mail.network.PacketRegistryMail; import forestry.mail.tiles.TileMailbox; import forestry.mail.tiles.TilePhilatelist; import forestry.mail.tiles.TileTrader; @@ -159,15 +152,8 @@ public class PluginMail extends ForestryPlugin { } @Override - public void registerPacketHandlers() { - PacketIdServer.LETTER_INFO_REQUEST.setPacketHandler(new PacketLetterInfoRequest()); - PacketIdServer.TRADING_ADDRESS_REQUEST.setPacketHandler(new PacketTraderAddressRequest()); - PacketIdServer.POBOX_INFO_REQUEST.setPacketHandler(new PacketPOBoxInfoRequest()); - PacketIdServer.LETTER_TEXT_SET.setPacketHandler(new PacketLetterTextSet()); - - PacketIdClient.LETTER_INFO_RESPONSE.setPacketHandler(new PacketLetterInfoResponse()); - PacketIdClient.TRADING_ADDRESS_RESPONSE.setPacketHandler(new PacketTraderAddressResponse()); - PacketIdClient.POBOX_INFO_RESPONSE.setPacketHandler(new PacketPOBoxInfoResponse()); + public IPacketRegistry getPacketRegistry() { + return new PacketRegistryMail(); } @Override diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index 9065461e6..3371482d2 100644 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -154,7 +154,7 @@ public class PluginManager { guiHandlers.add(guiHandler); } - plugin.registerPacketHandlers(); + plugin.getPacketRegistry().registerPackets(); IPickupHandler pickupHandler = plugin.getPickupHandler(); if (pickupHandler != null) { diff --git a/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java b/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java index 6496c276e..799e8260a 100755 --- a/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java +++ b/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import forestry.core.gui.ContainerItemInventory; import forestry.core.gui.IGuiSelectable; import forestry.core.gui.slots.SlotFiltered; -import forestry.core.network.PacketGuiSelectRequest; +import forestry.core.network.packets.PacketGuiSelectRequest; import forestry.storage.inventory.ItemInventoryBackpackPaged; public class ContainerNaturalistBackpack extends ContainerItemInventory implements IGuiSelectable {