Clean up packet registration code

This commit is contained in:
mezz committed 2015-11-19 01:04:31 -08:00
1 parent a6ecc95f80
commit 4f19f95b71
123 files changed
+847 -301

No files matched your search

@@ -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;
@@ -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;
@@ -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<TileAlvearyPlain> {
@@ -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<TileBeeHousingBase> implements IContainerBeeHousing {
@@ -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<ItemInventoryImprinter> implements IGuiSelectable {
@@ -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<EntityMinecartBeeHousingBase> implements IContainerBeeHousing {
public ContainerMinecartBeehouse(InventoryPlayer player, EntityMinecartBeeHousingBase entity, boolean hasFrames) {
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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());
}
}
@@ -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);
@@ -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);
@@ -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);
@@ -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
@@ -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);
@@ -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
@@ -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
@@ -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;
@@ -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;
@@ -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());
}
}
@@ -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);
@@ -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;
@@ -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;
@@ -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;
/**
@@ -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 {
@@ -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;
@@ -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<ItemInventorySolderingIron> implements IGuiSelectable {
@@ -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;
@@ -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 {
@@ -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<T extends Entity & IInventory> extends ContainerForestry {
protected final T entity;
@@ -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;
@@ -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;
@@ -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<TileNaturalistChest> implements IGuiSelectable {
@@ -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;
@@ -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;
@@ -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;
@@ -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
@@ -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;
@@ -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;
@@ -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 {
@@ -18,4 +18,6 @@ public interface IForestryPacket {
void readData(DataInputStreamForestry data) throws IOException;
FMLProxyPacket getPacket();
IPacketId getPacketId();
}
@@ -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();
}
@@ -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();
}
@@ -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();
}
@@ -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);
}
@@ -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) {
@@ -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) {
@@ -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);
}
}
@@ -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());
}
}
@@ -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() {
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
@@ -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;
}
}
@@ -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 {
}
}
@@ -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 {
}
}
@@ -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;
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
@@ -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;
}
}
@@ -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 <T extends IStreamableGui & ILocatable> 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;
}
}
@@ -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;
}
}
@@ -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 <T extends TileForestry & IItemStackDisplay> 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;
}
}
@@ -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;
}
@@ -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;
}
}
@@ -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;
}
@@ -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 <T extends TileEntity & ISocketable> 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;
}
}
@@ -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;
}
}
@@ -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;
}
@@ -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;
}
}
@@ -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 <T extends TileEntity & IStreamable> 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;
}
}
@@ -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 {
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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());
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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 {
@@ -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 {
@@ -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;
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more