Rewrite networking code for the 100th time to fix memory leak

This commit is contained in:
Aidan C. Brady 2014-06-11 11:57:49 +02:00
parent be3883195c
commit e5f76907ce
103 changed files with 2683 additions and 2759 deletions

View file

@ -125,6 +125,18 @@ public class Coord4D
data.add(zCoord);
data.add(dimensionId);
}
/**
* Writes this Coord4D's data to a ByteBuf for packet transfer.
* @param dataStream - the ByteBuf to add the data to
*/
public void write(ByteBuf dataStream)
{
dataStream.writeInt(xCoord);
dataStream.writeInt(yCoord);
dataStream.writeInt(zCoord);
dataStream.writeInt(dimensionId);
}
/**
* Translates this Coord4D by the defined x, y, and z values.

View file

@ -23,13 +23,13 @@ import mekanism.common.item.ItemJetpack;
import mekanism.common.item.ItemJetpack.JetpackMode;
import mekanism.common.item.ItemScubaTank;
import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.network.PacketConfiguratorState;
import mekanism.common.network.PacketElectricBowState;
import mekanism.common.network.PacketJetpackData;
import mekanism.common.network.PacketJetpackData.JetpackPacket;
import mekanism.common.network.PacketScubaTankData;
import mekanism.common.network.PacketScubaTankData.ScubaTankPacket;
import mekanism.common.network.PacketWalkieTalkieState;
import mekanism.common.network.PacketConfiguratorState.ConfiguratorStateMessage;
import mekanism.common.network.PacketElectricBowState.ElectricBowStateMessage;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage.JetpackPacket;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage.ScubaTankPacket;
import mekanism.common.network.PacketWalkieTalkieState.WalkieTalkieStateMessage;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.StackUtils;
import net.minecraft.client.Minecraft;
@ -234,7 +234,7 @@ public class ClientTickHandler
if(!lastTickUpdate)
{
item.setState(stack, (byte)(item.getState(stack) < 3 ? item.getState(stack)+1 : 0));
Mekanism.packetPipeline.sendToServer(new PacketConfiguratorState(item.getState(stack)));
Mekanism.packetHandler.sendToServer(new ConfiguratorStateMessage(item.getState(stack)));
mc.thePlayer.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Configure State: " + item.getColor(item.getState(stack)) + item.getStateDisplay(item.getState(stack))));
lastTickUpdate = true;
}
@ -252,7 +252,7 @@ public class ClientTickHandler
if(!lastTickUpdate)
{
item.setFireState(stack, !item.getFireState(stack));
Mekanism.packetPipeline.sendToServer(new PacketElectricBowState(item.getFireState(stack)));
Mekanism.packetHandler.sendToServer(new ElectricBowStateMessage(item.getFireState(stack)));
mc.thePlayer.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Fire Mode: " + (item.getFireState(stack) ? (EnumColor.DARK_GREEN + "ON") : (EnumColor.DARK_RED + "OFF"))));
lastTickUpdate = true;
}
@ -271,7 +271,7 @@ public class ClientTickHandler
{
int newChan = item.getChannel(stack) < 9 ? item.getChannel(stack)+1 : 1;
item.setChannel(stack, newChan);
Mekanism.packetPipeline.sendToServer(new PacketWalkieTalkieState(newChan));
Mekanism.packetHandler.sendToServer(new WalkieTalkieStateMessage(newChan));
SoundHandler.playSound("mekanism:etc.Ding");
lastTickUpdate = true;
}
@ -289,7 +289,7 @@ public class ClientTickHandler
if(!lastTickUpdate)
{
((ItemJetpack)jetpack.getItem()).incrementMode(jetpack);
Mekanism.packetPipeline.sendToServer(new PacketJetpackData(JetpackPacket.MODE, null, false));
Mekanism.packetHandler.sendToServer(new JetpackDataMessage(JetpackPacket.MODE, null, false));
SoundHandler.playSound("mekanism:etc.Hydraulic");
lastTickUpdate = true;
}
@ -307,7 +307,7 @@ public class ClientTickHandler
if(!lastTickUpdate)
{
((ItemScubaTank)scubaTank.getItem()).toggleFlowing(scubaTank);
Mekanism.packetPipeline.sendToServer(new PacketScubaTankData(ScubaTankPacket.MODE, null, false));
Mekanism.packetHandler.sendToServer(new ScubaTankDataMessage(ScubaTankPacket.MODE, null, false));
SoundHandler.playSound("mekanism:etc.Hydraulic");
lastTickUpdate = true;
}
@ -342,7 +342,7 @@ public class ClientTickHandler
Mekanism.jetpackOn.remove(mc.thePlayer.getCommandSenderName());
}
Mekanism.packetPipeline.sendToServer(new PacketJetpackData(JetpackPacket.UPDATE, mc.thePlayer.getCommandSenderName(), isJetpackOn(mc.thePlayer)));
Mekanism.packetHandler.sendToServer(new JetpackDataMessage(JetpackPacket.UPDATE, mc.thePlayer.getCommandSenderName(), isJetpackOn(mc.thePlayer)));
}
if(Mekanism.gasmaskOn.contains(mc.thePlayer.getCommandSenderName()) != isGasMaskOn(mc.thePlayer))
@ -355,7 +355,7 @@ public class ClientTickHandler
Mekanism.gasmaskOn.remove(mc.thePlayer.getCommandSenderName());
}
Mekanism.packetPipeline.sendToServer(new PacketScubaTankData(ScubaTankPacket.UPDATE, mc.thePlayer.getCommandSenderName(), isGasMaskOn(mc.thePlayer)));
Mekanism.packetHandler.sendToServer(new ScubaTankDataMessage(ScubaTankPacket.UPDATE, mc.thePlayer.getCommandSenderName(), isGasMaskOn(mc.thePlayer)));
}
if(MekanismClient.audioHandler != null)

View file

@ -5,7 +5,7 @@ import mekanism.api.MekanismAPI.BoxBlacklistEvent;
import mekanism.client.sound.SoundHandler;
import mekanism.client.voice.VoiceClient;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketKey;
import mekanism.common.network.PacketKey.KeyMessage;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
@ -36,7 +36,7 @@ public class MekanismClient extends Mekanism
if(down != keyMap.has(Minecraft.getMinecraft().thePlayer, type))
{
Mekanism.packetPipeline.sendToServer(new PacketKey(type, down));
Mekanism.packetHandler.sendToServer(new KeyMessage(type, down));
keyMap.update(Minecraft.getMinecraft().thePlayer, type, down);
}
}

View file

@ -17,7 +17,7 @@ import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerChemicalCrystallizer;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityChemicalCrystallizer;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -155,7 +155,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -16,6 +16,7 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerChemicalInfuser;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityChemicalInfuser;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -129,7 +130,7 @@ public class GuiChemicalInfuser extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
else if(xAxis > 114 && xAxis < 132 && yAxis > 13 && yAxis < 21)
@ -137,7 +138,7 @@ public class GuiChemicalInfuser extends GuiMekanism
ArrayList data = new ArrayList();
data.add(1);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -17,7 +17,7 @@ import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerChemicalWasher;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityChemicalWasher;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -120,7 +120,7 @@ public class GuiChemicalWasher extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -12,9 +12,9 @@ import mekanism.common.Mekanism;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.network.PacketConfigurationUpdate;
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationPacket;
import mekanism.common.network.PacketSimpleGui;
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage;
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage.ConfigurationPacket;
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
import mekanism.common.tile.TileEntityContainerBlock;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -256,19 +256,19 @@ public class GuiConfiguration extends GuiMekanism
{
int guiId = MachineType.get(tile.getBlockType(), tile.getBlockMetadata()).guiId;
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketSimpleGui(Coord4D.get(tile), guiId));
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), guiId));
}
if(xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketConfigurationUpdate(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0));
}
if(xAxis >= 156 && xAxis <= 170 && yAxis >= 21 && yAxis <= 35)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketConfigurationUpdate(ConfigurationPacket.STRICT_INPUT, Coord4D.get(tile), 0, 0));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.STRICT_INPUT, Coord4D.get(tile), 0, 0));
}
}
@ -280,7 +280,7 @@ public class GuiConfiguration extends GuiMekanism
if(xAxis >= 80 && xAxis <= 96 && yAxis >= 49 && yAxis <= 65)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketConfigurationUpdate(ConfigurationPacket.EJECT_COLOR, Coord4D.get(tile), button, 0));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT_COLOR, Coord4D.get(tile), button, 0));
}
for(int i = 0; i < slotPosMap.size(); i++)
@ -291,7 +291,7 @@ public class GuiConfiguration extends GuiMekanism
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketConfigurationUpdate(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i));
}
}
@ -303,7 +303,7 @@ public class GuiConfiguration extends GuiMekanism
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketConfigurationUpdate(ConfigurationPacket.INPUT_COLOR, Coord4D.get(tile), button, i));
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.INPUT_COLOR, Coord4D.get(tile), button, i));
}
}
}

View file

@ -4,7 +4,7 @@ import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketSimpleGui;
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
@ -67,7 +67,7 @@ public class GuiConfigurationTab extends GuiElement
{
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
Mekanism.packetPipeline.sendToServer(new PacketSimpleGui(Coord4D.get(tileEntity), 9));
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 9));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -12,9 +12,9 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerDigitalMiner;
import mekanism.common.miner.ThreadMinerSearch.State;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -109,18 +109,18 @@ public class GuiDigitalMiner extends GuiMekanism
ArrayList data = new ArrayList();
data.add(3);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
else if(guibutton.id == 1)
{
ArrayList data = new ArrayList();
data.add(4);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
else if(guibutton.id == 2)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -299,7 +299,7 @@ public class GuiDigitalMiner extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
@ -309,7 +309,7 @@ public class GuiDigitalMiner extends GuiMekanism
ArrayList data = new ArrayList();
data.add(1);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
@ -319,7 +319,7 @@ public class GuiDigitalMiner extends GuiMekanism
ArrayList data = new ArrayList();
data.add(5);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77)
@ -329,7 +329,7 @@ public class GuiDigitalMiner extends GuiMekanism
ArrayList data = new ArrayList();
data.add(9);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
@ -369,7 +369,7 @@ public class GuiDigitalMiner extends GuiMekanism
data.add(true);
}
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
SoundHandler.playSound("gui.button.press");

View file

@ -15,9 +15,9 @@ import mekanism.common.miner.MItemStackFilter;
import mekanism.common.miner.MMaterialFilter;
import mekanism.common.miner.MOreDictFilter;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -174,17 +174,17 @@ public class GuiDigitalMinerConfig extends GuiMekanism
if(filter instanceof MItemStackFilter)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex()+i, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex()+i, 0));
}
else if(filter instanceof MOreDictFilter)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex()+i, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex()+i, 0));
}
else if(filter instanceof MMaterialFilter)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex()+i, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex()+i, 0));
}
}
}
@ -193,7 +193,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
}
if(xAxis >= 39 && xAxis <= 50 && yAxis >= 67 && yAxis <= 78)
@ -219,7 +219,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
ArrayList data = new ArrayList();
data.add(10);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}
@ -286,7 +286,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
if(guibutton.id == 0)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 5, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 5, 0, 0));
}
}
@ -507,7 +507,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
data.add(6);
data.add(toUse);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
radiusField.setText("");
}
@ -523,7 +523,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
data.add(7);
data.add(toUse);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
minField.setText("");
}
@ -539,7 +539,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
data.add(8);
data.add(toUse);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
maxField.setText("");
}

View file

@ -7,8 +7,8 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.IElectricChest;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerElectricChest;
import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage.ElectricChestPacketType;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -122,10 +122,10 @@ public class GuiElectricChest extends GuiMekanism
if(isBlock)
{
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.LOCK, !getLocked(), true, 0, 0, null, Coord4D.get(tileEntity)));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.LOCK, !getLocked(), true, 0, 0, null, Coord4D.get(tileEntity)));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.LOCK, !getLocked(), false, 0, 0, null, null));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.LOCK, !getLocked(), false, 0, 0, null, null));
ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
((IElectricChest)stack.getItem()).setLocked(stack, !getLocked());

View file

@ -16,7 +16,7 @@ import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerElectrolyticSeparator;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityElectrolyticSeparator;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -98,7 +98,7 @@ public class GuiElectrolyticSeparator extends GuiMekanism
ArrayList data = new ArrayList();
data.add((byte)0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
else if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
@ -106,7 +106,7 @@ public class GuiElectrolyticSeparator extends GuiMekanism
ArrayList data = new ArrayList();
data.add((byte)1);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -6,7 +6,7 @@ import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerGasTank;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -82,7 +82,7 @@ public class GuiGasTank extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -12,9 +12,9 @@ import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.TItemStackFilter;
import mekanism.common.transporter.TMaterialFilter;
@ -163,17 +163,17 @@ public class GuiLogisticalSorter extends GuiMekanism
if(filter instanceof TItemStackFilter)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex()+i, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex()+i, 0));
}
else if(filter instanceof TOreDictFilter)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex()+i, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex()+i, 0));
}
else if(filter instanceof TMaterialFilter)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex()+i, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex()+i, 0));
}
}
}
@ -184,7 +184,7 @@ public class GuiLogisticalSorter extends GuiMekanism
ArrayList data = new ArrayList();
data.add(1);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
@ -193,7 +193,7 @@ public class GuiLogisticalSorter extends GuiMekanism
ArrayList data = new ArrayList();
data.add(2);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}
@ -209,7 +209,7 @@ public class GuiLogisticalSorter extends GuiMekanism
data.add(0);
data.add(button);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("mekanism:etc.Ding");
}
}
@ -259,7 +259,7 @@ public class GuiLogisticalSorter extends GuiMekanism
if(guibutton.id == 0)
{
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
}
}

View file

@ -5,7 +5,8 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -50,15 +51,15 @@ public class GuiMFilterSelect extends GuiMekanism
if(guibutton.id == 0)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 1, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 1, 0, 0));
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 2, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 2, 0, 0));
}
else if(guibutton.id == 2)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 3, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 3, 0, 0));
}
}
@ -109,7 +110,7 @@ public class GuiMFilterSelect extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
}

View file

@ -6,10 +6,10 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.miner.MItemStackFilter;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -87,13 +87,13 @@ public class GuiMItemStackFilter extends GuiMekanism
{
if(isNew)
{
Mekanism.packetPipeline.sendToServer(new PacketNewFilter(Coord4D.get(tileEntity), filter));
Mekanism.packetHandler.sendToServer(new NewFilterMessage(Coord4D.get(tileEntity), filter));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
}
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
else if(filter.itemType == null)
{
@ -103,8 +103,8 @@ public class GuiMItemStackFilter extends GuiMekanism
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -200,7 +200,7 @@ public class GuiMItemStackFilter extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0));
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)

View file

@ -6,10 +6,10 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.miner.MMaterialFilter;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -87,13 +87,13 @@ public class GuiMMaterialFilter extends GuiMekanism
{
if(isNew)
{
Mekanism.packetPipeline.sendToServer(new PacketNewFilter(Coord4D.get(tileEntity), filter));
Mekanism.packetHandler.sendToServer(new NewFilterMessage(Coord4D.get(tileEntity), filter));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
}
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
else if(filter.materialItem == null)
{
@ -103,8 +103,8 @@ public class GuiMMaterialFilter extends GuiMekanism
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -200,7 +200,7 @@ public class GuiMMaterialFilter extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0));
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)

View file

@ -9,10 +9,10 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.miner.MOreDictFilter;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -131,13 +131,13 @@ public class GuiMOreDictFilter extends GuiMekanism
{
if(isNew)
{
Mekanism.packetPipeline.sendToServer(new PacketNewFilter(Coord4D.get(tileEntity), filter));
Mekanism.packetHandler.sendToServer(new NewFilterMessage(Coord4D.get(tileEntity), filter));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
}
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
else {
status = EnumColor.DARK_RED + "No key";
@ -146,8 +146,8 @@ public class GuiMOreDictFilter extends GuiMekanism
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -264,7 +264,7 @@ public class GuiMOreDictFilter extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0));
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0));
}
if(xAxis >= 131 && xAxis <= 143 && yAxis >= 47 && yAxis <= 59)

View file

@ -13,7 +13,7 @@ import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityMetallurgicInfuser;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -121,7 +121,7 @@ public class GuiMetallurgicInfuser extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -6,8 +6,8 @@ import mekanism.api.energy.IEnergizedItem;
import mekanism.client.sound.SoundHandler;
import mekanism.common.IElectricChest;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage.ElectricChestPacketType;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -136,11 +136,11 @@ public class GuiPasswordEnter extends GuiScreen
if(isBlock)
{
tileEntity.setEnergy(tileEntity.getEnergy() - 100);
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.SERVER_OPEN, true, true, 0, 0, null, Coord4D.get(tileEntity)));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, true, true, 0, 0, null, Coord4D.get(tileEntity)));
}
else {
((IEnergizedItem)itemStack.getItem()).setEnergy(itemStack, ((IEnergizedItem)itemStack.getItem()).getEnergy(itemStack) - 100);
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.SERVER_OPEN, true, false, 0, 0, null, null));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, true, false, 0, 0, null, null));
}
SoundHandler.playSound("mekanism:etc.Success");

View file

@ -4,8 +4,8 @@ import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.common.IElectricChest;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage.ElectricChestPacketType;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -162,13 +162,13 @@ public class GuiPasswordModify extends GuiScreen
else {
if(isBlock)
{
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.PASSWORD, true, false, 0, 0, confirmPasswordField.getText(), Coord4D.get(tileEntity)));
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.SERVER_OPEN, false, true, 0, 0, null, Coord4D.get(tileEntity)));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.PASSWORD, true, false, 0, 0, confirmPasswordField.getText(), Coord4D.get(tileEntity)));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, false, true, 0, 0, null, Coord4D.get(tileEntity)));
}
else {
((IElectricChest)itemStack.getItem()).setPassword(itemStack, confirmPasswordField.getText());
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.PASSWORD, false, false, 0, 0, confirmPasswordField.getText(), null));
Mekanism.packetPipeline.sendToServer(new PacketElectricChest(ElectricChestPacketType.SERVER_OPEN, false, false, 0, 0, null, null));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.PASSWORD, false, false, 0, 0, confirmPasswordField.getText(), null));
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, false, false, 0, 0, null, null));
}
}
}

View file

@ -3,8 +3,8 @@ package mekanism.client.gui;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.item.ItemPortableTeleporter;
import mekanism.common.network.PacketDigitUpdate;
import mekanism.common.network.PacketPortableTeleport;
import mekanism.common.network.PacketDigitUpdate.DigitUpdateMessage;
import mekanism.common.network.PacketPortableTeleport.PortableTeleportMessage;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton;
@ -83,7 +83,7 @@ public class GuiPortableTeleporter extends GuiScreen
{
if(guibutton.id == 0)
{
Mekanism.packetPipeline.sendToServer(new PacketPortableTeleport());
Mekanism.packetHandler.sendToServer(new PortableTeleportMessage());
mc.setIngameFocus();
}
}
@ -98,25 +98,25 @@ public class GuiPortableTeleporter extends GuiScreen
if(xAxis > 23 && xAxis < 37 && yAxis > 44 && yAxis < 58)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitUpdate(0, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 0))));
Mekanism.packetHandler.sendToServer(new DigitUpdateMessage(0, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 0))));
((ItemPortableTeleporter)itemStack.getItem()).setDigit(itemStack, 0, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 0)));
SoundHandler.playSound("gui.button.press");
}
else if(xAxis > 62 && xAxis < 76 && yAxis > 44 && yAxis < 58)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitUpdate(1, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 1))));
Mekanism.packetHandler.sendToServer(new DigitUpdateMessage(1, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 1))));
((ItemPortableTeleporter)itemStack.getItem()).setDigit(itemStack, 1, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 1)));
SoundHandler.playSound("gui.button.press");
}
else if(xAxis > 101 && xAxis < 115 && yAxis > 44 && yAxis < 58)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitUpdate(2, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 2))));
Mekanism.packetHandler.sendToServer(new DigitUpdateMessage(2, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 2))));
((ItemPortableTeleporter)itemStack.getItem()).setDigit(itemStack, 2, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 2)));
SoundHandler.playSound("gui.button.press");
}
else if(xAxis > 140 && xAxis < 154 && yAxis > 44 && yAxis < 58)
{
Mekanism.packetPipeline.sendToServer(new PacketDigitUpdate(3, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 3))));
Mekanism.packetHandler.sendToServer(new DigitUpdateMessage(3, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 3))));
((ItemPortableTeleporter)itemStack.getItem()).setDigit(itemStack, 3, getIncrementedNumber(((ItemPortableTeleporter)itemStack.getItem()).getDigit(itemStack, 3)));
SoundHandler.playSound("gui.button.press");
}

View file

@ -5,7 +5,7 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.IRedstoneControl;
import mekanism.common.IRedstoneControl.RedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketRedstoneControl;
import mekanism.common.network.PacketRedstoneControl.RedstoneControlMessage;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
@ -74,7 +74,7 @@ public class GuiRedstoneControl extends GuiElement
int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0;
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRedstoneControl(Coord4D.get(tileEntity), RedstoneControl.values()[ordinalToSet]));
Mekanism.packetHandler.sendToServer(new RedstoneControlMessage(Coord4D.get(tileEntity), RedstoneControl.values()[ordinalToSet]));
}
}
}

View file

@ -3,8 +3,8 @@ package mekanism.client.gui;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerRobitCrafting;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketRobit.RobitMessage.RobitPacketType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
@ -104,7 +104,7 @@ public class GuiRobitCrafting extends GuiMekanism
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 0, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
@ -114,19 +114,19 @@ public class GuiRobitCrafting extends GuiMekanism
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 2, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 3, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 4, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, entityId, 0, 0);
}
}

View file

@ -4,8 +4,8 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.entity.EntityRobit;
import mekanism.common.inventory.container.ContainerRobitInventory;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketRobit.RobitMessage.RobitPacketType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
@ -104,13 +104,13 @@ public class GuiRobitInventory extends GuiMekanism
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 0, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 1, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
@ -120,13 +120,13 @@ public class GuiRobitInventory extends GuiMekanism
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 3, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 4, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0);
}
}

View file

@ -4,8 +4,8 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.entity.EntityRobit;
import mekanism.common.inventory.container.ContainerRobitMain;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketRobit.RobitMessage.RobitPacketType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton;
@ -46,7 +46,7 @@ public class GuiRobitMain extends GuiMekanism
{
if(nameChangeField.getText() != null && !nameChangeField.getText().isEmpty())
{
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.NAME, robit.getEntityId(), 0, nameChangeField.getText()));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.NAME, robit.getEntityId(), 0, nameChangeField.getText()));
toggleNameChange();
nameChangeField.setText("");
}
@ -271,31 +271,31 @@ public class GuiRobitMain extends GuiMekanism
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 1, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 2, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 3, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 4, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 54 && yAxis <= 72)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.FOLLOW, robit.getEntityId(), 0, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.FOLLOW, robit.getEntityId(), 0, null));
}
else if(xAxis >= 6 && xAxis <= 24 && yAxis >= 54 && yAxis <= 72)
{
@ -305,13 +305,13 @@ public class GuiRobitMain extends GuiMekanism
else if(xAxis >= 6 && xAxis <= 24 && yAxis >= 16 && yAxis <= 34)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GO_HOME, robit.getEntityId(), 0, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GO_HOME, robit.getEntityId(), 0, null));
mc.displayGuiScreen(null);
}
else if(xAxis >= 6 && xAxis <= 24 && yAxis >= 35 && yAxis <= 53)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.DROP_PICKUP, robit.getEntityId(), 0, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.DROP_PICKUP, robit.getEntityId(), 0, null));
}
}
}

View file

@ -5,8 +5,8 @@ import java.util.List;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerRobitRepair;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketRobit.RobitMessage.RobitPacketType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiTextField;
@ -149,25 +149,25 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 0, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 1, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 2, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 3, entityId, null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, entityId, null));
mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, entityId, 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108)

View file

@ -4,8 +4,8 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.entity.EntityRobit;
import mekanism.common.inventory.container.ContainerRobitSmelting;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketRobit.RobitMessage.RobitPacketType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
@ -111,19 +111,19 @@ public class GuiRobitSmelting extends GuiMekanism
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 0, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 1, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 2, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.getEntityId(), 0, 0);
}
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88)
@ -133,7 +133,7 @@ public class GuiRobitSmelting extends GuiMekanism
else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 4, robit.getEntityId(), null));
Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null));
mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0);
}
}

View file

@ -13,7 +13,7 @@ import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerRotaryCondensentrator;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityRotaryCondensentrator;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -154,7 +154,7 @@ public class GuiRotaryCondensentrator extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -8,7 +8,7 @@ import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerSalinationController;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntitySalinationController;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -156,7 +156,7 @@ public class GuiSalinationController extends GuiMekanism
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -5,7 +5,7 @@ import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -70,7 +70,7 @@ public class GuiSortingTab extends GuiElement
{
ArrayList data = new ArrayList();
data.add(0);
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}

View file

@ -4,8 +4,8 @@ import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -50,15 +50,15 @@ public class GuiTFilterSelect extends GuiMekanism
if(guibutton.id == 0)
{
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 1, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 1, 0, 0));
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 2, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 2, 0, 0));
}
else if(guibutton.id == 2)
{
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 3, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 3, 0, 0));
}
}
@ -109,7 +109,7 @@ public class GuiTFilterSelect extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
}

View file

@ -6,10 +6,10 @@ import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.TItemStackFilter;
import mekanism.common.util.MekanismUtils;
@ -107,13 +107,13 @@ public class GuiTItemStackFilter extends GuiMekanism
if(isNew)
{
Mekanism.packetPipeline.sendToServer(new PacketNewFilter(Coord4D.get(tileEntity), filter));
Mekanism.packetHandler.sendToServer(new NewFilterMessage(Coord4D.get(tileEntity), filter));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
}
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
else if(min > max)
{
@ -139,8 +139,8 @@ public class GuiTItemStackFilter extends GuiMekanism
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -297,7 +297,7 @@ public class GuiTItemStackFilter extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 4 : 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 4 : 0, 0, 0));
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)

View file

@ -6,10 +6,10 @@ import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.TMaterialFilter;
import mekanism.common.util.MekanismUtils;
@ -90,13 +90,13 @@ public class GuiTMaterialFilter extends GuiMekanism
{
if(isNew)
{
Mekanism.packetPipeline.sendToServer(new PacketNewFilter(Coord4D.get(tileEntity), filter));
Mekanism.packetHandler.sendToServer(new NewFilterMessage(Coord4D.get(tileEntity), filter));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
}
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
else if(filter.materialItem == null)
{
@ -106,8 +106,8 @@ public class GuiTMaterialFilter extends GuiMekanism
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -228,7 +228,7 @@ public class GuiTMaterialFilter extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 4 : 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 4 : 0, 0, 0));
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)

View file

@ -9,10 +9,10 @@ import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.TOreDictFilter;
import mekanism.common.util.MekanismUtils;
@ -133,13 +133,13 @@ public class GuiTOreDictFilter extends GuiMekanism
{
if(isNew)
{
Mekanism.packetPipeline.sendToServer(new PacketNewFilter(Coord4D.get(tileEntity), filter));
Mekanism.packetHandler.sendToServer(new NewFilterMessage(Coord4D.get(tileEntity), filter));
}
else {
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
}
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
else {
status = EnumColor.DARK_RED + MekanismUtils.localize("gui.oredictFilter.noKey");
@ -148,8 +148,8 @@ public class GuiTOreDictFilter extends GuiMekanism
}
else if(guibutton.id == 1)
{
Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
}
}
@ -291,7 +291,7 @@ public class GuiTOreDictFilter extends GuiMekanism
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketLogisticalSorterGui(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 4 : 0, 0, 0));
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 4 : 0, 0, 0));
}
if(xAxis >= 131 && xAxis <= 143 && yAxis >= 47 && yAxis <= 59)

View file

@ -8,7 +8,7 @@ import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerTeleporter;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityTeleporter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -66,7 +66,7 @@ public class GuiTeleporter extends GuiMekanism
data.add(0);
data.add(getIncrementedNumber(tileEntity.code.digitOne));
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
tileEntity.code.digitOne = getIncrementedNumber(tileEntity.code.digitOne);
SoundHandler.playSound("gui.button.press");
}
@ -75,7 +75,7 @@ public class GuiTeleporter extends GuiMekanism
data.add(1);
data.add(getIncrementedNumber(tileEntity.code.digitTwo));
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
tileEntity.code.digitTwo = getIncrementedNumber(tileEntity.code.digitTwo);
SoundHandler.playSound("gui.button.press");
}
@ -84,7 +84,7 @@ public class GuiTeleporter extends GuiMekanism
data.add(2);
data.add(getIncrementedNumber(tileEntity.code.digitThree));
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
tileEntity.code.digitThree = getIncrementedNumber(tileEntity.code.digitThree);
SoundHandler.playSound("gui.button.press");
}
@ -93,7 +93,7 @@ public class GuiTeleporter extends GuiMekanism
data.add(3);
data.add(getIncrementedNumber(tileEntity.code.digitFour));
Mekanism.packetPipeline.sendToServer(new PacketTileEntity(Coord4D.get(tileEntity), data));
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
tileEntity.code.digitFour = getIncrementedNumber(tileEntity.code.digitFour);
SoundHandler.playSound("gui.button.press");
}

View file

@ -4,7 +4,7 @@ import mekanism.api.Coord4D;
import mekanism.client.sound.SoundHandler;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketRemoveUpgrade;
import mekanism.common.network.PacketRemoveUpgrade.RemoveUpgradeMessage;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
@ -82,13 +82,13 @@ public class GuiUpgradeManagement extends GuiElement
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRemoveUpgrade(Coord4D.get(tileEntity), (byte)0));
Mekanism.packetHandler.sendToServer(new RemoveUpgradeMessage(Coord4D.get(tileEntity), (byte)0));
}
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetPipeline.sendToServer(new PacketRemoveUpgrade(Coord4D.get(tileEntity), (byte)1));
Mekanism.packetHandler.sendToServer(new RemoveUpgradeMessage(Coord4D.get(tileEntity), (byte)1));
}
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)

View file

@ -24,7 +24,6 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.util.TransporterUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.IIconRegister;

View file

@ -6,7 +6,7 @@ import mekanism.common.item.ItemJetpack;
import mekanism.common.item.ItemJetpack.JetpackMode;
import mekanism.common.item.ItemPortableTeleporter;
import mekanism.common.item.ItemScubaTank;
import mekanism.common.network.PacketStatusUpdate;
import mekanism.common.network.PacketStatusUpdate.StatusUpdateMessage;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -47,14 +47,14 @@ public class CommonPlayerTickHandler
if(item.getStatus(itemstack) != 2)
{
item.setStatus(itemstack, 2);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(2), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new StatusUpdateMessage(2), (EntityPlayerMP)player);
}
}
else {
if(item.getStatus(itemstack) != 1)
{
item.setStatus(itemstack, 1);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(1), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new StatusUpdateMessage(1), (EntityPlayerMP)player);
}
}
return;
@ -64,7 +64,7 @@ public class CommonPlayerTickHandler
if(item.getStatus(itemstack) != 3)
{
item.setStatus(itemstack, 3);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(3), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new StatusUpdateMessage(3), (EntityPlayerMP)player);
}
return;
}
@ -72,7 +72,7 @@ public class CommonPlayerTickHandler
if(item.getStatus(itemstack) != 4)
{
item.setStatus(itemstack, 4);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(4), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new StatusUpdateMessage(4), (EntityPlayerMP)player);
}
return;
}
@ -81,7 +81,7 @@ public class CommonPlayerTickHandler
if(item.getStatus(itemstack) != 4)
{
item.setStatus(itemstack, 4);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(4), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new StatusUpdateMessage(4), (EntityPlayerMP)player);
}
return;
}

View file

@ -1,11 +1,11 @@
package mekanism.common;
import mekanism.common.network.PacketBoxBlacklist;
import mekanism.common.network.PacketConfigSync;
import mekanism.common.network.PacketJetpackData;
import mekanism.common.network.PacketJetpackData.JetpackPacket;
import mekanism.common.network.PacketScubaTankData;
import mekanism.common.network.PacketScubaTankData.ScubaTankPacket;
import mekanism.common.network.PacketBoxBlacklist.BoxBlacklistMessage;
import mekanism.common.network.PacketConfigSync.ConfigSyncMessage;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage.JetpackPacket;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage.ScubaTankPacket;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -25,10 +25,10 @@ public class CommonPlayerTracker
{
if(!event.player.worldObj.isRemote)
{
Mekanism.packetPipeline.sendTo(new PacketConfigSync(), (EntityPlayerMP)event.player);
Mekanism.packetPipeline.sendTo(new PacketBoxBlacklist(), (EntityPlayerMP)event.player);
Mekanism.packetPipeline.sendTo(new PacketJetpackData(JetpackPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.packetPipeline.sendTo(new PacketScubaTankData(ScubaTankPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.packetHandler.sendTo(new ConfigSyncMessage(), (EntityPlayerMP)event.player);
Mekanism.packetHandler.sendTo(new BoxBlacklistMessage(), (EntityPlayerMP)event.player);
Mekanism.packetHandler.sendTo(new JetpackDataMessage(JetpackPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.packetHandler.sendTo(new ScubaTankDataMessage(ScubaTankPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.logger.info("Sent config to '" + event.player.getDisplayName() + ".'");
}
@ -48,8 +48,8 @@ public class CommonPlayerTracker
if(!event.player.worldObj.isRemote)
{
Mekanism.packetPipeline.sendTo(new PacketJetpackData(JetpackPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.packetPipeline.sendTo(new PacketScubaTankData(ScubaTankPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.packetHandler.sendTo(new JetpackDataMessage(JetpackPacket.FULL, null, false), (EntityPlayerMP)event.player);
Mekanism.packetHandler.sendTo(new ScubaTankDataMessage(ScubaTankPacket.FULL, null, false), (EntityPlayerMP)event.player);
}
}
}

View file

@ -89,10 +89,9 @@ import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.multipart.ItemGlowPanel;
import mekanism.common.multipart.ItemPartTransmitter;
import mekanism.common.multipart.MultipartMekanism;
import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketPipeline;
import mekanism.common.network.PacketTransmitterUpdate;
import mekanism.common.network.PacketTransmitterUpdate.PacketType;
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage.PacketType;
import mekanism.common.recipe.BinRecipe;
import mekanism.common.recipe.MekanismRecipe;
import mekanism.common.recipe.RecipeHandler;
@ -160,7 +159,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class Mekanism
{
/** Mekanism Packet Pipeline */
public static final PacketPipeline packetPipeline = new PacketPipeline();
public static PacketHandler packetHandler = new PacketHandler();
/** Mekanism logger instance */
public static Logger logger = LogManager.getLogger("Mekanism");
@ -1319,7 +1318,7 @@ public class Mekanism
new MultipartMekanism();
//Packet registrations
packetPipeline.initialize();
packetHandler.initialize();
//Load proxy
proxy.registerRenderInformation();
@ -1343,8 +1342,6 @@ public class Mekanism
addIntegratedItems();
OreDictManager.init();
packetPipeline.postInitialize();
logger.info("Hooking complete.");
}
@ -1353,7 +1350,7 @@ public class Mekanism
public void onEnergyTransferred(EnergyTransferEvent event)
{
try {
packetPipeline.sendToCuboid(new PacketTransmitterUpdate(PacketType.ENERGY, (TileEntity)event.energyNetwork.transmitters.iterator().next(), event.power), event.energyNetwork.getPacketRange(), event.energyNetwork.getDimension());
packetHandler.sendToCuboid(new TransmitterUpdateMessage(PacketType.ENERGY, Coord4D.get((TileEntity)event.energyNetwork.transmitters.iterator().next()), event.power), event.energyNetwork.getPacketRange(), event.energyNetwork.getDimension());
} catch(Exception e) {}
}
@ -1361,7 +1358,7 @@ public class Mekanism
public void onGasTransferred(GasTransferEvent event)
{
try {
packetPipeline.sendToCuboid(new PacketTransmitterUpdate(PacketType.GAS, (TileEntity)event.gasNetwork.transmitters.iterator().next(), event.transferType, event.didTransfer), event.gasNetwork.getPacketRange(), event.gasNetwork.getDimension());
packetHandler.sendToCuboid(new TransmitterUpdateMessage(PacketType.GAS, Coord4D.get((TileEntity)event.gasNetwork.transmitters.iterator().next()), event.transferType, event.didTransfer), event.gasNetwork.getPacketRange(), event.gasNetwork.getDimension());
} catch(Exception e) {}
}
@ -1369,7 +1366,7 @@ public class Mekanism
public void onLiquidTransferred(FluidTransferEvent event)
{
try {
packetPipeline.sendToCuboid(new PacketTransmitterUpdate(PacketType.FLUID, (TileEntity)event.fluidNetwork.transmitters.iterator().next(), event.fluidType, event.didTransfer), event.fluidNetwork.getPacketRange(), event.fluidNetwork.getDimension());
packetHandler.sendToCuboid(new TransmitterUpdateMessage(PacketType.FLUID, Coord4D.get((TileEntity)event.fluidNetwork.transmitters.iterator().next()), event.fluidType, event.didTransfer), event.fluidNetwork.getPacketRange(), event.fluidNetwork.getDimension());
} catch(Exception e) {}
}
@ -1377,7 +1374,7 @@ public class Mekanism
public void onNetworkClientRequest(NetworkClientRequest event)
{
try {
packetPipeline.sendToServer(new PacketDataRequest(Coord4D.get(event.tileEntity)));
packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(event.tileEntity)));
} catch(Exception e) {}
}

View file

@ -3,6 +3,69 @@ package mekanism.common;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import mekanism.common.network.PacketBoxBlacklist;
import mekanism.common.network.PacketBoxBlacklist.BoxBlacklistMessage;
import mekanism.common.network.PacketConfigSync;
import mekanism.common.network.PacketConfigSync.ConfigSyncMessage;
import mekanism.common.network.PacketConfigurationUpdate;
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage;
import mekanism.common.network.PacketConfiguratorState;
import mekanism.common.network.PacketConfiguratorState.ConfiguratorStateMessage;
import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
import mekanism.common.network.PacketDigitUpdate;
import mekanism.common.network.PacketDigitUpdate.DigitUpdateMessage;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketEditFilter;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketElectricBowState;
import mekanism.common.network.PacketElectricBowState.ElectricBowStateMessage;
import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketJetpackData;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage;
import mekanism.common.network.PacketKey;
import mekanism.common.network.PacketKey.KeyMessage;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketNewFilter;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.network.PacketPortableTeleport;
import mekanism.common.network.PacketPortableTeleport.PortableTeleportMessage;
import mekanism.common.network.PacketPortalFX;
import mekanism.common.network.PacketPortalFX.PortalFXMessage;
import mekanism.common.network.PacketRedstoneControl;
import mekanism.common.network.PacketRedstoneControl.RedstoneControlMessage;
import mekanism.common.network.PacketRemoveUpgrade;
import mekanism.common.network.PacketRemoveUpgrade.RemoveUpgradeMessage;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketScubaTankData;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage;
import mekanism.common.network.PacketSimpleGui;
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
import mekanism.common.network.PacketStatusUpdate;
import mekanism.common.network.PacketStatusUpdate.StatusUpdateMessage;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.network.PacketTransmitterUpdate;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage;
import mekanism.common.network.PacketWalkieTalkieState;
import mekanism.common.network.PacketWalkieTalkieState.WalkieTalkieStateMessage;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
/**
* Mekanism packet handler. As always, use packets sparingly!
@ -11,6 +74,46 @@ import java.util.ArrayList;
*/
public class PacketHandler
{
public SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel("MEK");
private int packetsRegistered = 0;
public void initialize()
{
netHandler.registerMessage(PacketRobit.class, RobitMessage.class, 0, Side.SERVER);
netHandler.registerMessage(PacketTransmitterUpdate.class, TransmitterUpdateMessage.class, 1, Side.CLIENT);
netHandler.registerMessage(PacketElectricChest.class, ElectricChestMessage.class, 2, Side.CLIENT);
netHandler.registerMessage(PacketElectricChest.class, ElectricChestMessage.class, 2, Side.SERVER);
netHandler.registerMessage(PacketElectricBowState.class, ElectricBowStateMessage.class, 3, Side.SERVER);
netHandler.registerMessage(PacketConfiguratorState.class, ConfiguratorStateMessage.class, 4, Side.SERVER);
netHandler.registerMessage(PacketTileEntity.class, TileEntityMessage.class, 5, Side.CLIENT);
netHandler.registerMessage(PacketTileEntity.class, TileEntityMessage.class, 5, Side.SERVER);
netHandler.registerMessage(PacketPortalFX.class, PortalFXMessage.class, 6, Side.CLIENT);
netHandler.registerMessage(PacketDataRequest.class, DataRequestMessage.class, 7, Side.SERVER);
netHandler.registerMessage(PacketStatusUpdate.class, StatusUpdateMessage.class, 8, Side.CLIENT);
netHandler.registerMessage(PacketDigitUpdate.class, DigitUpdateMessage.class, 9, Side.SERVER);
netHandler.registerMessage(PacketPortableTeleport.class, PortableTeleportMessage.class, 10, Side.SERVER);
netHandler.registerMessage(PacketRemoveUpgrade.class, RemoveUpgradeMessage.class, 11, Side.SERVER);
netHandler.registerMessage(PacketRedstoneControl.class, RedstoneControlMessage.class, 12, Side.SERVER);
netHandler.registerMessage(PacketWalkieTalkieState.class, WalkieTalkieStateMessage.class, 13, Side.SERVER);
netHandler.registerMessage(PacketLogisticalSorterGui.class, LogisticalSorterGuiMessage.class, 14, Side.CLIENT);
netHandler.registerMessage(PacketLogisticalSorterGui.class, LogisticalSorterGuiMessage.class, 14, Side.SERVER);
netHandler.registerMessage(PacketNewFilter.class, NewFilterMessage.class, 15, Side.SERVER);
netHandler.registerMessage(PacketEditFilter.class, EditFilterMessage.class, 16, Side.SERVER);
netHandler.registerMessage(PacketConfigurationUpdate.class, ConfigurationUpdateMessage.class, 17, Side.SERVER);
netHandler.registerMessage(PacketSimpleGui.class, SimpleGuiMessage.class, 18, Side.CLIENT);
netHandler.registerMessage(PacketSimpleGui.class, SimpleGuiMessage.class, 18, Side.SERVER);
netHandler.registerMessage(PacketDigitalMinerGui.class, DigitalMinerGuiMessage.class, 19, Side.CLIENT);
netHandler.registerMessage(PacketDigitalMinerGui.class, DigitalMinerGuiMessage.class, 19, Side.SERVER);
netHandler.registerMessage(PacketJetpackData.class, JetpackDataMessage.class, 20, Side.CLIENT);
netHandler.registerMessage(PacketJetpackData.class, JetpackDataMessage.class, 20, Side.SERVER);
netHandler.registerMessage(PacketKey.class, KeyMessage.class, 21, Side.SERVER);
netHandler.registerMessage(PacketScubaTankData.class, ScubaTankDataMessage.class, 22, Side.CLIENT);
netHandler.registerMessage(PacketScubaTankData.class, ScubaTankDataMessage.class, 22, Side.SERVER);
netHandler.registerMessage(PacketConfigSync.class, ConfigSyncMessage.class, 23, Side.CLIENT);
netHandler.registerMessage(PacketBoxBlacklist.class, BoxBlacklistMessage.class, 24, Side.CLIENT);
}
/**
* Encodes an Object[] of data into a DataOutputStream.
* @param dataValues - an Object[] of data to encode
@ -80,4 +183,86 @@ public class PacketHandler
{
return new String(input.readBytes(input.readInt()).array());
}
public static EntityPlayer getPlayer(MessageContext context)
{
if(context.side.isClient())
{
return Minecraft.getMinecraft().thePlayer;
}
else {
return context.getServerHandler().playerEntity;
}
}
/**
* Send this message to everyone.
* @param message - the message to send
*/
public void sendToAll(IMessage message)
{
netHandler.sendToAll(message);
}
/**
* Send this message to the specified player.
* @param message - the message to send
* @param player - the player to send it to
*/
public void sendTo(IMessage message, EntityPlayerMP player)
{
netHandler.sendTo(message, player);
}
/**
* Send this message to everyone within a certain range of a point.
*
* @param message - the message to send
* @param point - the TargetPoint around which to send
*/
public void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point)
{
netHandler.sendToAllAround(message, point);
}
/**
* Send this message to everyone within the supplied dimension.
* @param message - the message to send
* @param dimensionId - the dimension id to target
*/
public void sendToDimension(IMessage message, int dimensionId)
{
netHandler.sendToDimension(message, dimensionId);
}
/**
* Send this message to the server.
* @param message - the message to send
*/
public void sendToServer(IMessage message)
{
netHandler.sendToServer(message);
}
/**
* Send this message to all players within a defined AABB cuboid.
* @param message - the message to send
* @param cuboid - the AABB cuboid to send the packet in
* @param dimId - the dimension the cuboid is in
*/
public void sendToCuboid(IMessage message, AxisAlignedBB cuboid, int dimId)
{
MinecraftServer server = MinecraftServer.getServer();
if(server != null && cuboid != null)
{
for(EntityPlayerMP player : (List<EntityPlayerMP>)server.getConfigurationManager().playerEntityList)
{
if(cuboid.isVecInside(Vec3.createVectorHelper(player.posX, player.posY, player.posZ)))
{
sendTo(message, player);
}
}
}
}
}

View file

@ -12,7 +12,7 @@ import mekanism.common.IBoundingBlock;
import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism;
import mekanism.common.inventory.InventoryBin;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tank.TankUpdateProtocol;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityBin;
@ -420,7 +420,7 @@ public class BlockBasic extends Block
if(!manageInventory(entityplayer, tileEntity))
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
entityplayer.openGui(Mekanism.instance, 18, world, x, y, z);
}
else {

View file

@ -20,10 +20,10 @@ import mekanism.common.IUpgradeManagement;
import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage.ElectricChestPacketType;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.tile.TileEntityAdvancedFactory;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityChargepad;
@ -741,10 +741,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
}
else if(!electricChest.authenticated)
{
Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, true, false, 2, 0, null, Coord4D.get(electricChest)), (EntityPlayerMP)entityplayer);
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, true, false, 2, 0, null, Coord4D.get(electricChest)), (EntityPlayerMP)entityplayer);
}
else {
Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, true, false, 1, 0, null, Coord4D.get(electricChest)), (EntityPlayerMP)entityplayer);
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, true, false, 1, 0, null, Coord4D.get(electricChest)), (EntityPlayerMP)entityplayer);
}
return true;
@ -753,7 +753,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
else if(metadata == MachineType.LOGISTICAL_SORTER.meta)
{
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter)tileEntity;
PacketLogisticalSorterGui.openServerGui(SorterGuiPacket.SERVER, 0, world, (EntityPlayerMP)entityplayer, Coord4D.get(tileEntity), -1);
LogisticalSorterGuiMessage.openServerGui(SorterGuiPacket.SERVER, 0, world, (EntityPlayerMP)entityplayer, Coord4D.get(tileEntity), -1);
return true;
}
else {

View file

@ -14,7 +14,7 @@ import mekanism.common.ISustainedInventory;
import mekanism.common.Mekanism;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.integration.IC2ItemManager;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityEnergyCube;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
@ -91,7 +91,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
if(!world.isRemote)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
}
}

View file

@ -25,8 +25,8 @@ import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.integration.IC2ItemManager;
import mekanism.common.inventory.InventoryElectricChest;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage.ElectricChestPacketType;
import mekanism.common.tile.TileEntityChemicalInfuser;
import mekanism.common.tile.TileEntityChemicalOxidizer;
import mekanism.common.tile.TileEntityDigitalMiner;
@ -521,11 +521,11 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
{
if(!getAuthenticated(itemstack))
{
Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, false, false, 2, 0, null, null), (EntityPlayerMP)entityplayer);
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, false, false, 2, 0, null, null), (EntityPlayerMP)entityplayer);
}
else if(getLocked(itemstack) && getEnergy(itemstack) > 0)
{
Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, false, false, 1, 0, null, null), (EntityPlayerMP)entityplayer);
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, false, false, 1, 0, null, null), (EntityPlayerMP)entityplayer);
}
else {
InventoryElectricChest inventory = new InventoryElectricChest(entityplayer);

View file

@ -9,7 +9,7 @@ import mekanism.api.EnumColor;
import mekanism.common.IConfigurable;
import mekanism.common.IInvConfiguration;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.util.MekanismUtils;
@ -97,7 +97,7 @@ public class ItemConfigurator extends ItemEnergized implements IToolWrench
if(config instanceof TileEntityBasicBlock)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), Coord4D.get(tileEntity).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), Coord4D.get(tileEntity).getTargetPoint(50D));
}
return true;

View file

@ -7,7 +7,7 @@ import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.transporter.TransporterStack;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
@ -121,7 +121,7 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
refreshConnections();
tile().notifyPartChange(this);
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleDiverter") + ": " + EnumColor.RED + description));
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getNetworkedData(new ArrayList())), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getNetworkedData(new ArrayList())), Coord4D.get(tile()).getTargetPoint(50D));
return true;
}

View file

@ -13,8 +13,8 @@ import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.HashList;
import mekanism.common.ILogisticalTransporter;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.InvStack;
import mekanism.common.transporter.TransporterManager;
@ -324,7 +324,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
for(TransporterStack stack : remove)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, true)), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getSyncPacket(stack, true)), Coord4D.get(tile()).getTargetPoint(50D));
transit.remove(stack);
MekanismUtils.saveChunk(tile());
}
@ -333,7 +333,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
{
if(transit.contains(stack))
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
}
}
@ -438,7 +438,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
{
transit.add(stack);
TransporterManager.add(stack);
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
MekanismUtils.saveChunk(tile());
}
@ -474,7 +474,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
{
transit.add(stack);
TransporterManager.add(stack);
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
MekanismUtils.saveChunk(tile());
}
@ -489,7 +489,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
{
stack.progress = 0;
transit.add(stack);
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D));
MekanismUtils.saveChunk(tile());
}
@ -500,7 +500,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
if(world().isRemote)
{
Mekanism.packetPipeline.sendToServer(new PacketDataRequest(Coord4D.get(tile())));
Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(tile())));
}
}
@ -679,7 +679,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
TransporterUtils.incrementColor(this);
refreshConnections();
tile().notifyPartChange(this);
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getNetworkedData(new ArrayList())), Coord4D.get(tile()).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(tile()), getNetworkedData(new ArrayList())), Coord4D.get(tile()).getTargetPoint(50D));
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleColor") + ": " + (color != null ? color.getName() : EnumColor.BLACK + MekanismUtils.localize("gui.none"))));
return true;

View file

@ -11,8 +11,8 @@ import mekanism.api.transmitters.TransmitterNetworkRegistry;
import mekanism.client.ClientTickHandler;
import mekanism.common.IConfigurable;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTransmitterUpdate;
import mekanism.common.network.PacketTransmitterUpdate.PacketType;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage.PacketType;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import codechicken.multipart.TileMultipart;
@ -202,7 +202,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
if(!world().isRemote)
{
Mekanism.packetPipeline.sendToDimension(new PacketTransmitterUpdate(PacketType.UPDATE, tile()), world().provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new TransmitterUpdateMessage(PacketType.UPDATE, Coord4D.get(tile())), world().provider.dimensionId);
}
}
@ -213,7 +213,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
if(!world().isRemote)
{
Mekanism.packetPipeline.sendToDimension(new PacketTransmitterUpdate(PacketType.UPDATE, tile()), world().provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new TransmitterUpdateMessage(PacketType.UPDATE, Coord4D.get(tile())), world().provider.dimensionId);
}
}

View file

@ -1,39 +0,0 @@
package mekanism.common.network;
import java.io.DataOutputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import com.google.common.io.ByteArrayDataInput;
public interface IMekanismPacket
{
/**
* Gets this packet's identifier. This will show up in console logs to specify packet types.
* @return this packet's identifier
*/
public String getName();
/**
* Sets the parameters of this packet for writing.
* @param data - data to set
*/
public IMekanismPacket setParams(Object... data);
/**
* Reads this packet's data from a ByteArrayDataInput, and handles it as needed.
* @param dataStream - data stream being sent
* @param player - player this packet was sent to, or sent by
* @param world - world this packet was handled in
* @throws Exception - the exception thrown in case anything goes wrong
*/
public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception;
/**
* Writes this packet's data to a DataOutputStream.
* @param dataStream - data stream being sent
* @throws Exception - the exception thrown in case anything goes wrong
*/
public void write(DataOutputStream dataStream) throws Exception;
}

View file

@ -1,50 +0,0 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
/**
* AbstractPacket class. Should be the parent of all packets wishing to use the
* PacketPipeline.
*
* @author unpairedbracket based on sirgingalot's tutorial
*/
public abstract class MekanismPacket
{
/**
* Encode the packet data into the ByteBuf stream. Complex data sets may
* need specific data handlers (See
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
*
* @param ctx - channel context
* @param buffer - the buffer to encode into
*/
public abstract void write(ChannelHandlerContext ctx, ByteBuf dataStream) throws Exception;
/**
* Decode the packet data from the ByteBuf stream. Complex data sets may
* need specific data handlers (See
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
*
* @param ctx - channel context
* @param buffer - the buffer to decode from
*/
public abstract void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream) throws Exception;
/**
* Handle a packet on the client side. Note this occurs after decoding has
* completed.
*
* @param player - the player reference
*/
public abstract void handleClientSide(EntityPlayer player) throws Exception;
/**
* Handle a packet on the server side. Note this occurs after decoding has
* completed.
*
* @param player - the player reference
*/
public abstract void handleServerSide(EntityPlayer player) throws Exception;
}

View file

@ -1,53 +1,53 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.ItemInfo;
import mekanism.api.MekanismAPI;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketBoxBlacklist.BoxBlacklistMessage;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketBoxBlacklist extends MekanismPacket
public class PacketBoxBlacklist implements IMessageHandler<BoxBlacklistMessage, IMessage>
{
public PacketBoxBlacklist() {}
@Override
public IMessage onMessage(BoxBlacklistMessage message, MessageContext context)
{
return null;
}
public static class BoxBlacklistMessage implements IMessage
{
public BoxBlacklistMessage() {}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(MekanismAPI.getBoxIgnore().size());
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
{
dataStream.writeInt(MekanismAPI.getBoxIgnore().size());
for(ItemInfo info : MekanismAPI.getBoxIgnore())
{
dataStream.writeInt(Block.getIdFromBlock(info.block));
dataStream.writeInt(info.meta);
for(ItemInfo info : MekanismAPI.getBoxIgnore())
{
dataStream.writeInt(Block.getIdFromBlock(info.block));
dataStream.writeInt(info.meta);
}
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
MekanismAPI.getBoxIgnore().clear();
int amount = dataStream.readInt();
for(int i = 0; i < amount; i++)
@Override
public void fromBytes(ByteBuf dataStream)
{
MekanismAPI.addBoxBlacklist(Block.getBlockById(dataStream.readInt()), dataStream.readInt());
MekanismAPI.getBoxIgnore().clear();
int amount = dataStream.readInt();
for(int i = 0; i < amount; i++)
{
MekanismAPI.addBoxBlacklist(Block.getBlockById(dataStream.readInt()), dataStream.readInt());
}
Mekanism.logger.info("Received Cardboard Box blacklist entries from server (" + amount + " total)");
}
Mekanism.logger.info("Received Cardboard Box blacklist entries from server (" + amount + " total)");
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,141 +1,148 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.IModule;
import mekanism.common.Mekanism;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketConfigSync.ConfigSyncMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketConfigSync extends MekanismPacket
public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMessage>
{
public PacketConfigSync() {}
@Override
public IMessage onMessage(ConfigSyncMessage message, MessageContext context)
{
return null;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream) throws Exception
public static class ConfigSyncMessage implements IMessage
{
dataStream.writeBoolean(Mekanism.osmiumGenerationEnabled);
dataStream.writeBoolean(Mekanism.copperGenerationEnabled);
dataStream.writeBoolean(Mekanism.tinGenerationEnabled);
dataStream.writeBoolean(Mekanism.disableBCSteelCrafting);
dataStream.writeBoolean(Mekanism.disableBCBronzeCrafting);
dataStream.writeBoolean(Mekanism.updateNotifications);
dataStream.writeBoolean(Mekanism.controlCircuitOreDict);
dataStream.writeBoolean(Mekanism.logPackets);
dataStream.writeBoolean(Mekanism.dynamicTankEasterEgg);
dataStream.writeBoolean(Mekanism.voiceServerEnabled);
dataStream.writeBoolean(Mekanism.forceBuildcraft);
dataStream.writeBoolean(Mekanism.cardboardSpawners);
dataStream.writeInt(Mekanism.obsidianTNTDelay);
dataStream.writeInt(Mekanism.obsidianTNTBlastRadius);
dataStream.writeInt(Mekanism.UPDATE_DELAY);
dataStream.writeInt(Mekanism.osmiumGenerationAmount);
dataStream.writeInt(Mekanism.copperGenerationAmount);
dataStream.writeInt(Mekanism.tinGenerationAmount);
dataStream.writeDouble(Mekanism.FROM_IC2);
dataStream.writeDouble(Mekanism.TO_IC2);
dataStream.writeDouble(Mekanism.FROM_BC);
dataStream.writeDouble(Mekanism.TO_BC);
dataStream.writeDouble(Mekanism.FROM_H2);
dataStream.writeDouble(Mekanism.ENERGY_PER_REDSTONE);
dataStream.writeInt(Mekanism.VOICE_PORT);
dataStream.writeInt(Mekanism.maxUpgradeMultiplier);
dataStream.writeDouble(Mekanism.enrichmentChamberUsage);
dataStream.writeDouble(Mekanism.osmiumCompressorUsage);
dataStream.writeDouble(Mekanism.combinerUsage);
dataStream.writeDouble(Mekanism.crusherUsage);
dataStream.writeDouble(Mekanism.factoryUsage);
dataStream.writeDouble(Mekanism.metallurgicInfuserUsage);
dataStream.writeDouble(Mekanism.purificationChamberUsage);
dataStream.writeDouble(Mekanism.energizedSmelterUsage);
dataStream.writeDouble(Mekanism.digitalMinerUsage);
dataStream.writeDouble(Mekanism.electricPumpUsage);
dataStream.writeDouble(Mekanism.rotaryCondensentratorUsage);
dataStream.writeDouble(Mekanism.oxidationChamberUsage);
dataStream.writeDouble(Mekanism.chemicalInfuserUsage);
dataStream.writeDouble(Mekanism.chemicalInjectionChamberUsage);
dataStream.writeDouble(Mekanism.precisionSawmillUsage);
dataStream.writeDouble(Mekanism.chemicalDissolutionChamberUsage);
dataStream.writeDouble(Mekanism.chemicalWasherUsage);
dataStream.writeDouble(Mekanism.chemicalCrystallizerUsage);
dataStream.writeDouble(Mekanism.seismicVibratorUsage);
for(IModule module : Mekanism.modulesLoaded)
public ConfigSyncMessage() {}
@Override
public void toBytes(ByteBuf dataStream)
{
module.writeConfig(dataStream);
dataStream.writeBoolean(Mekanism.osmiumGenerationEnabled);
dataStream.writeBoolean(Mekanism.copperGenerationEnabled);
dataStream.writeBoolean(Mekanism.tinGenerationEnabled);
dataStream.writeBoolean(Mekanism.disableBCSteelCrafting);
dataStream.writeBoolean(Mekanism.disableBCBronzeCrafting);
dataStream.writeBoolean(Mekanism.updateNotifications);
dataStream.writeBoolean(Mekanism.controlCircuitOreDict);
dataStream.writeBoolean(Mekanism.logPackets);
dataStream.writeBoolean(Mekanism.dynamicTankEasterEgg);
dataStream.writeBoolean(Mekanism.voiceServerEnabled);
dataStream.writeBoolean(Mekanism.forceBuildcraft);
dataStream.writeBoolean(Mekanism.cardboardSpawners);
dataStream.writeInt(Mekanism.obsidianTNTDelay);
dataStream.writeInt(Mekanism.obsidianTNTBlastRadius);
dataStream.writeInt(Mekanism.UPDATE_DELAY);
dataStream.writeInt(Mekanism.osmiumGenerationAmount);
dataStream.writeInt(Mekanism.copperGenerationAmount);
dataStream.writeInt(Mekanism.tinGenerationAmount);
dataStream.writeDouble(Mekanism.FROM_IC2);
dataStream.writeDouble(Mekanism.TO_IC2);
dataStream.writeDouble(Mekanism.FROM_BC);
dataStream.writeDouble(Mekanism.TO_BC);
dataStream.writeDouble(Mekanism.FROM_H2);
dataStream.writeDouble(Mekanism.ENERGY_PER_REDSTONE);
dataStream.writeInt(Mekanism.VOICE_PORT);
dataStream.writeInt(Mekanism.maxUpgradeMultiplier);
dataStream.writeDouble(Mekanism.enrichmentChamberUsage);
dataStream.writeDouble(Mekanism.osmiumCompressorUsage);
dataStream.writeDouble(Mekanism.combinerUsage);
dataStream.writeDouble(Mekanism.crusherUsage);
dataStream.writeDouble(Mekanism.factoryUsage);
dataStream.writeDouble(Mekanism.metallurgicInfuserUsage);
dataStream.writeDouble(Mekanism.purificationChamberUsage);
dataStream.writeDouble(Mekanism.energizedSmelterUsage);
dataStream.writeDouble(Mekanism.digitalMinerUsage);
dataStream.writeDouble(Mekanism.electricPumpUsage);
dataStream.writeDouble(Mekanism.rotaryCondensentratorUsage);
dataStream.writeDouble(Mekanism.oxidationChamberUsage);
dataStream.writeDouble(Mekanism.chemicalInfuserUsage);
dataStream.writeDouble(Mekanism.chemicalInjectionChamberUsage);
dataStream.writeDouble(Mekanism.precisionSawmillUsage);
dataStream.writeDouble(Mekanism.chemicalDissolutionChamberUsage);
dataStream.writeDouble(Mekanism.chemicalWasherUsage);
dataStream.writeDouble(Mekanism.chemicalCrystallizerUsage);
dataStream.writeDouble(Mekanism.seismicVibratorUsage);
try {
for(IModule module : Mekanism.modulesLoaded)
{
module.writeConfig(dataStream);
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream) throws Exception
{
Mekanism.osmiumGenerationEnabled = dataStream.readBoolean();
Mekanism.copperGenerationEnabled = dataStream.readBoolean();
Mekanism.tinGenerationEnabled = dataStream.readBoolean();
Mekanism.disableBCSteelCrafting = dataStream.readBoolean();
Mekanism.disableBCBronzeCrafting = dataStream.readBoolean();
Mekanism.updateNotifications = dataStream.readBoolean();
Mekanism.controlCircuitOreDict = dataStream.readBoolean();
Mekanism.logPackets = dataStream.readBoolean();
Mekanism.dynamicTankEasterEgg = dataStream.readBoolean();
Mekanism.voiceServerEnabled = dataStream.readBoolean();
Mekanism.forceBuildcraft = dataStream.readBoolean();
Mekanism.cardboardSpawners = dataStream.readBoolean();
Mekanism.obsidianTNTDelay = dataStream.readInt();
Mekanism.obsidianTNTBlastRadius = dataStream.readInt();
Mekanism.UPDATE_DELAY = dataStream.readInt();
Mekanism.osmiumGenerationAmount = dataStream.readInt();
Mekanism.copperGenerationAmount = dataStream.readInt();
Mekanism.tinGenerationAmount = dataStream.readInt();
Mekanism.FROM_IC2 = dataStream.readDouble();
Mekanism.TO_IC2 = dataStream.readDouble();
Mekanism.FROM_BC = dataStream.readDouble();
Mekanism.TO_BC = dataStream.readDouble();
Mekanism.FROM_H2 = dataStream.readDouble();
Mekanism.ENERGY_PER_REDSTONE = dataStream.readDouble();
Mekanism.VOICE_PORT = dataStream.readInt();
Mekanism.maxUpgradeMultiplier = dataStream.readInt();
Mekanism.TO_TE = Mekanism.TO_BC*10;
Mekanism.FROM_TE = Mekanism.FROM_BC/10;
Mekanism.enrichmentChamberUsage = dataStream.readDouble();
Mekanism.osmiumCompressorUsage = dataStream.readDouble();
Mekanism.combinerUsage = dataStream.readDouble();
Mekanism.crusherUsage = dataStream.readDouble();
Mekanism.factoryUsage = dataStream.readDouble();
Mekanism.metallurgicInfuserUsage = dataStream.readDouble();
Mekanism.purificationChamberUsage = dataStream.readDouble();
Mekanism.energizedSmelterUsage = dataStream.readDouble();
Mekanism.digitalMinerUsage = dataStream.readDouble();
Mekanism.electricPumpUsage = dataStream.readDouble();
Mekanism.rotaryCondensentratorUsage = dataStream.readDouble();
Mekanism.oxidationChamberUsage = dataStream.readDouble();
Mekanism.chemicalInfuserUsage = dataStream.readDouble();
Mekanism.chemicalInjectionChamberUsage = dataStream.readDouble();
Mekanism.precisionSawmillUsage = dataStream.readDouble();
Mekanism.chemicalDissolutionChamberUsage = dataStream.readDouble();
Mekanism.chemicalWasherUsage = dataStream.readDouble();
Mekanism.chemicalCrystallizerUsage = dataStream.readDouble();
Mekanism.seismicVibratorUsage = dataStream.readDouble();
for(IModule module : Mekanism.modulesLoaded)
@Override
public void fromBytes(ByteBuf dataStream)
{
module.readConfig(dataStream);
Mekanism.osmiumGenerationEnabled = dataStream.readBoolean();
Mekanism.copperGenerationEnabled = dataStream.readBoolean();
Mekanism.tinGenerationEnabled = dataStream.readBoolean();
Mekanism.disableBCSteelCrafting = dataStream.readBoolean();
Mekanism.disableBCBronzeCrafting = dataStream.readBoolean();
Mekanism.updateNotifications = dataStream.readBoolean();
Mekanism.controlCircuitOreDict = dataStream.readBoolean();
Mekanism.logPackets = dataStream.readBoolean();
Mekanism.dynamicTankEasterEgg = dataStream.readBoolean();
Mekanism.voiceServerEnabled = dataStream.readBoolean();
Mekanism.forceBuildcraft = dataStream.readBoolean();
Mekanism.cardboardSpawners = dataStream.readBoolean();
Mekanism.obsidianTNTDelay = dataStream.readInt();
Mekanism.obsidianTNTBlastRadius = dataStream.readInt();
Mekanism.UPDATE_DELAY = dataStream.readInt();
Mekanism.osmiumGenerationAmount = dataStream.readInt();
Mekanism.copperGenerationAmount = dataStream.readInt();
Mekanism.tinGenerationAmount = dataStream.readInt();
Mekanism.FROM_IC2 = dataStream.readDouble();
Mekanism.TO_IC2 = dataStream.readDouble();
Mekanism.FROM_BC = dataStream.readDouble();
Mekanism.TO_BC = dataStream.readDouble();
Mekanism.FROM_H2 = dataStream.readDouble();
Mekanism.ENERGY_PER_REDSTONE = dataStream.readDouble();
Mekanism.VOICE_PORT = dataStream.readInt();
Mekanism.maxUpgradeMultiplier = dataStream.readInt();
Mekanism.TO_TE = Mekanism.TO_BC*10;
Mekanism.FROM_TE = Mekanism.FROM_BC/10;
Mekanism.enrichmentChamberUsage = dataStream.readDouble();
Mekanism.osmiumCompressorUsage = dataStream.readDouble();
Mekanism.combinerUsage = dataStream.readDouble();
Mekanism.crusherUsage = dataStream.readDouble();
Mekanism.factoryUsage = dataStream.readDouble();
Mekanism.metallurgicInfuserUsage = dataStream.readDouble();
Mekanism.purificationChamberUsage = dataStream.readDouble();
Mekanism.energizedSmelterUsage = dataStream.readDouble();
Mekanism.digitalMinerUsage = dataStream.readDouble();
Mekanism.electricPumpUsage = dataStream.readDouble();
Mekanism.rotaryCondensentratorUsage = dataStream.readDouble();
Mekanism.oxidationChamberUsage = dataStream.readDouble();
Mekanism.chemicalInfuserUsage = dataStream.readDouble();
Mekanism.chemicalInjectionChamberUsage = dataStream.readDouble();
Mekanism.precisionSawmillUsage = dataStream.readDouble();
Mekanism.chemicalDissolutionChamberUsage = dataStream.readDouble();
Mekanism.chemicalWasherUsage = dataStream.readDouble();
Mekanism.chemicalCrystallizerUsage = dataStream.readDouble();
Mekanism.seismicVibratorUsage = dataStream.readDouble();
try {
for(IModule module : Mekanism.modulesLoaded)
{
module.readConfig(dataStream);
}
} catch(Exception e) {
e.printStackTrace();
}
Mekanism.proxy.onConfigSync();
}
Mekanism.proxy.onConfigSync();
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.ArrayList;
@ -9,6 +8,10 @@ import mekanism.api.Coord4D;
import mekanism.common.IInvConfiguration;
import mekanism.common.ITileNetwork;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage;
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage.ConfigurationPacket;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.TransporterUtils;
@ -16,172 +19,179 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketConfigurationUpdate extends MekanismPacket
public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationUpdateMessage, IMessage>
{
public Coord4D coord4D;
public int configIndex;
public int inputSide;
public int clickType;
public ConfigurationPacket packetType;
public PacketConfigurationUpdate() {}
public PacketConfigurationUpdate(ConfigurationPacket type, Coord4D coord, int click, int extra)
{
packetType = type;
coord4D = coord;
if(packetType == ConfigurationPacket.EJECT_COLOR)
{
clickType = click;
}
if(packetType == ConfigurationPacket.SIDE_DATA)
{
clickType = click;
configIndex = extra;
}
if(packetType == ConfigurationPacket.INPUT_COLOR)
{
clickType = click;
inputSide = extra;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(ConfigurationUpdateMessage message, MessageContext context)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
if(packetType != ConfigurationPacket.EJECT && packetType != ConfigurationPacket.STRICT_INPUT)
{
dataStream.writeInt(clickType);
}
if(packetType == ConfigurationPacket.SIDE_DATA)
{
dataStream.writeInt(configIndex);
}
if(packetType == ConfigurationPacket.INPUT_COLOR)
{
dataStream.writeInt(inputSide);
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
packetType = ConfigurationPacket.values()[dataStream.readInt()];
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
TileEntity tile = coord4D.getTileEntity(player.worldObj);
TileEntity tile = message.coord4D.getTileEntity(PacketHandler.getPlayer(context).worldObj);
if(tile instanceof IInvConfiguration)
{
IInvConfiguration config = (IInvConfiguration)tile;
if(packetType == ConfigurationPacket.EJECT)
if(message.packetType == ConfigurationPacket.EJECT)
{
config.getEjector().setEjecting(!config.getEjector().isEjecting());
}
else if(packetType == ConfigurationPacket.SIDE_DATA)
else if(message.packetType == ConfigurationPacket.SIDE_DATA)
{
clickType = dataStream.readInt();
configIndex = dataStream.readInt();
if(clickType == 0)
if(message.clickType == 0)
{
MekanismUtils.incrementOutput((IInvConfiguration)tile, configIndex);
MekanismUtils.incrementOutput((IInvConfiguration)tile, message.configIndex);
}
else if(clickType == 1)
else if(message.clickType == 1)
{
MekanismUtils.decrementOutput((IInvConfiguration)tile, configIndex);
MekanismUtils.decrementOutput((IInvConfiguration)tile, message.configIndex);
}
else if(clickType == 2)
else if(message.clickType == 2)
{
((IInvConfiguration)tile).getConfiguration()[configIndex] = 0;
((IInvConfiguration)tile).getConfiguration()[message.configIndex] = 0;
}
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(coord4D, ((ITileNetwork) tile).getNetworkedData(new ArrayList())), coord4D.getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(message.coord4D, ((ITileNetwork)tile).getNetworkedData(new ArrayList())), message.coord4D.getTargetPoint(50D));
}
else if(packetType == ConfigurationPacket.EJECT_COLOR)
else if(message.packetType == ConfigurationPacket.EJECT_COLOR)
{
clickType = dataStream.readInt();
if(clickType == 0)
if(message.clickType == 0)
{
config.getEjector().setOutputColor(TransporterUtils.increment(config.getEjector().getOutputColor()));
}
else if(clickType == 1)
else if(message.clickType == 1)
{
config.getEjector().setOutputColor(TransporterUtils.decrement(config.getEjector().getOutputColor()));
}
else if(clickType == 2)
else if(message.clickType == 2)
{
config.getEjector().setOutputColor(null);
}
}
else if(packetType == ConfigurationPacket.INPUT_COLOR)
else if(message.packetType == ConfigurationPacket.INPUT_COLOR)
{
clickType = dataStream.readInt();
inputSide = dataStream.readInt();
ForgeDirection side = ForgeDirection.getOrientation(message.inputSide);
ForgeDirection side = ForgeDirection.getOrientation(inputSide);
if(clickType == 0)
if(message.clickType == 0)
{
config.getEjector().setInputColor(side, TransporterUtils.increment(config.getEjector().getInputColor(side)));
}
else if(clickType == 1)
else if(message.clickType == 1)
{
config.getEjector().setInputColor(side, TransporterUtils.decrement(config.getEjector().getInputColor(side)));
}
else if(clickType == 2)
else if(message.clickType == 2)
{
config.getEjector().setInputColor(side, null);
}
}
else if(packetType == ConfigurationPacket.STRICT_INPUT)
else if(message.packetType == ConfigurationPacket.STRICT_INPUT)
{
config.getEjector().setStrictInput(!config.getEjector().hasStrictInput());
}
for(EntityPlayer p : ((TileEntityBasicBlock)config).playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(coord4D, ((ITileNetwork) tile).getNetworkedData(new ArrayList())), (EntityPlayerMP)p);
Mekanism.packetHandler.sendTo(new TileEntityMessage(message.coord4D, ((ITileNetwork)tile).getNetworkedData(new ArrayList())), (EntityPlayerMP)p);
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class ConfigurationUpdateMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum ConfigurationPacket
{
EJECT, SIDE_DATA, EJECT_COLOR, INPUT_COLOR, STRICT_INPUT
public Coord4D coord4D;
public int configIndex;
public int inputSide;
public int clickType;
public ConfigurationPacket packetType;
public ConfigurationUpdateMessage() {}
public ConfigurationUpdateMessage(ConfigurationPacket type, Coord4D coord, int click, int extra)
{
packetType = type;
coord4D = coord;
if(packetType == ConfigurationPacket.EJECT_COLOR)
{
clickType = click;
}
if(packetType == ConfigurationPacket.SIDE_DATA)
{
clickType = click;
configIndex = extra;
}
if(packetType == ConfigurationPacket.INPUT_COLOR)
{
clickType = click;
inputSide = extra;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
if(packetType != ConfigurationPacket.EJECT && packetType != ConfigurationPacket.STRICT_INPUT)
{
dataStream.writeInt(clickType);
}
if(packetType == ConfigurationPacket.SIDE_DATA)
{
dataStream.writeInt(configIndex);
}
if(packetType == ConfigurationPacket.INPUT_COLOR)
{
dataStream.writeInt(inputSide);
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = ConfigurationPacket.values()[dataStream.readInt()];
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
if(packetType == ConfigurationPacket.SIDE_DATA)
{
clickType = dataStream.readInt();
configIndex = dataStream.readInt();
}
else if(packetType == ConfigurationPacket.EJECT_COLOR)
{
clickType = dataStream.readInt();
}
else if(packetType == ConfigurationPacket.INPUT_COLOR)
{
clickType = dataStream.readInt();
inputSide = dataStream.readInt();
}
}
public static enum ConfigurationPacket
{
EJECT, SIDE_DATA, EJECT_COLOR, INPUT_COLOR, STRICT_INPUT
}
}
}

View file

@ -1,50 +1,50 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemConfigurator;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketConfiguratorState.ConfiguratorStateMessage;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketConfiguratorState extends MekanismPacket
public class PacketConfiguratorState implements IMessageHandler<ConfiguratorStateMessage, IMessage>
{
public byte state;
public PacketConfiguratorState() {}
public PacketConfiguratorState(byte s)
{
state = s;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(ConfiguratorStateMessage message, MessageContext context)
{
dataStream.writeByte(state);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
byte state = dataStream.readByte();
ItemStack itemstack = player.getCurrentEquippedItem();
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
if(itemstack != null && itemstack.getItem() instanceof ItemConfigurator)
{
((ItemConfigurator)itemstack.getItem()).setState(itemstack, (byte)state);
((ItemConfigurator)itemstack.getItem()).setState(itemstack, (byte)message.state);
}
return null;
}
public static class ConfiguratorStateMessage implements IMessage
{
public byte state;
public ConfiguratorStateMessage() {}
public ConfiguratorStateMessage(byte s)
{
state = s;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeByte(state);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
state = dataStream.readByte();
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.ArrayList;
@ -10,47 +9,30 @@ import mekanism.api.transmitters.DynamicNetwork;
import mekanism.api.transmitters.IGridTransmitter;
import mekanism.common.ITileNetwork;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityDynamicTank;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketDataRequest extends MekanismPacket
public class PacketDataRequest implements IMessageHandler<DataRequestMessage, IMessage>
{
public Coord4D coord4D;
public PacketDataRequest() {}
public PacketDataRequest(Coord4D coord)
{
coord4D = coord;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(DataRequestMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
int id = dataStream.readInt();
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(id);
if(worldServer != null && worldServer.getTileEntity(x, y, z) instanceof ITileNetwork)
EntityPlayer player = PacketHandler.getPlayer(context);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
if(worldServer != null && message.coord4D.getTileEntity(worldServer) instanceof ITileNetwork)
{
TileEntity tileEntity = worldServer.getTileEntity(x, y, z);
TileEntity tileEntity = message.coord4D.getTileEntity(worldServer);
if(tileEntity instanceof TileEntityDynamicTank)
{
@ -67,19 +49,37 @@ public class PacketDataRequest extends MekanismPacket
}
}
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(worldServer.getTileEntity(x, y, z)), ((ITileNetwork) worldServer.getTileEntity(x, y, z)).getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(tileEntity), ((ITileNetwork)tileEntity).getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
return null;
}
public static class DataRequestMessage implements IMessage
{
public Coord4D coord4D;
public DataRequestMessage() {}
public DataRequestMessage(Coord4D coord)
{
coord4D = coord;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,55 +1,55 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemPortableTeleporter;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketDigitUpdate.DigitUpdateMessage;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketDigitUpdate extends MekanismPacket
public class PacketDigitUpdate implements IMessageHandler<DigitUpdateMessage, IMessage>
{
public int index;
public int digit;
public PacketDigitUpdate() {}
public PacketDigitUpdate(int ind, int dig)
{
index = ind;
digit = dig;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(DigitUpdateMessage message, MessageContext context)
{
dataStream.writeInt(index);
dataStream.writeInt(digit);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
int index = dataStream.readInt();
int digit = dataStream.readInt();
ItemStack currentStack = player.getCurrentEquippedItem();
ItemStack currentStack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
if(currentStack != null && currentStack.getItem() instanceof ItemPortableTeleporter)
{
ItemPortableTeleporter item = (ItemPortableTeleporter)currentStack.getItem();
item.setDigit(currentStack, index, digit);
item.setDigit(currentStack, message.index, message.digit);
}
return null;
}
public static class DigitUpdateMessage implements IMessage
{
public int index;
public int digit;
public DigitUpdateMessage() {}
public DigitUpdateMessage(int ind, int dig)
{
index = ind;
digit = dig;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(index);
dataStream.writeInt(digit);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
index = dataStream.readInt();
digit = dataStream.readInt();
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.ArrayList;
@ -13,9 +12,13 @@ import mekanism.client.gui.GuiMItemStackFilter;
import mekanism.client.gui.GuiMMaterialFilter;
import mekanism.client.gui.GuiMOreDictFilter;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.inventory.container.ContainerDigitalMiner;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage.MinerGuiPacket;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityContainerBlock;
import mekanism.common.tile.TileEntityDigitalMiner;
import net.minecraft.client.gui.GuiScreen;
@ -24,233 +27,235 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PacketDigitalMinerGui extends MekanismPacket
public class PacketDigitalMinerGui implements IMessageHandler<DigitalMinerGuiMessage, IMessage>
{
public Coord4D object3D;
public MinerGuiPacket packetType;
public int guiType;
public int windowId = -1;
public int index = -1;
public PacketDigitalMinerGui() {}
public PacketDigitalMinerGui(MinerGuiPacket type, Coord4D coord, int guiID, int extra, int extra2)
{
packetType = type;
object3D = coord;
guiType = guiID;
if(packetType == MinerGuiPacket.CLIENT)
{
windowId = extra;
}
else if(packetType == MinerGuiPacket.SERVER_INDEX)
{
index = extra;
}
else if(packetType == MinerGuiPacket.CLIENT_INDEX)
{
windowId = extra;
index = extra2;
}
}
public static void openServerGui(MinerGuiPacket t, int guiType, World world, EntityPlayerMP playerMP, Coord4D obj, int i)
{
Container container = null;
playerMP.closeContainer();
if(guiType == 0)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 4)
{
container = new ContainerDigitalMiner(playerMP.inventory, (TileEntityDigitalMiner)obj.getTileEntity(world));
}
else if(guiType == 5)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 1 || guiType == 2 || guiType == 3)
{
container = new ContainerFilter(playerMP.inventory, (TileEntityContainerBlock)obj.getTileEntity(world));
}
playerMP.getNextWindowId();
int window = playerMP.currentWindowId;
if(t == MinerGuiPacket.SERVER)
{
Mekanism.packetPipeline.sendTo(new PacketDigitalMinerGui(MinerGuiPacket.CLIENT, obj, guiType, window, 0), playerMP);
}
else if(t == MinerGuiPacket.SERVER_INDEX)
{
Mekanism.packetPipeline.sendTo(new PacketDigitalMinerGui(MinerGuiPacket.CLIENT_INDEX, obj, guiType, window, i), playerMP);
}
playerMP.openContainer = container;
playerMP.openContainer.windowId = window;
playerMP.openContainer.addCraftingToCrafters(playerMP);
if(guiType == 0)
{
TileEntityDigitalMiner tile = (TileEntityDigitalMiner)obj.getTileEntity(world);
for(EntityPlayer player : tile.playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(obj, tile.getFilterPacket(new ArrayList())), (EntityPlayerMP)player);
}
}
}
@SideOnly(Side.CLIENT)
public GuiScreen getGui(MinerGuiPacket packetType, int type, EntityPlayer player, World world, int x, int y, int z, int index)
{
if(type == 0)
{
return new GuiDigitalMinerConfig(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 4)
{
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 5)
{
return new GuiMFilterSelect(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else {
if(packetType == MinerGuiPacket.CLIENT)
{
if(type == 1)
{
return new GuiMItemStackFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 2)
{
return new GuiMOreDictFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 3)
{
return new GuiMMaterialFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
}
else if(packetType == MinerGuiPacket.CLIENT_INDEX)
{
if(type == 1)
{
return new GuiMItemStackFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z), index);
}
else if(type == 2)
{
return new GuiMOreDictFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z), index);
}
else if(type == 3)
{
return new GuiMMaterialFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z), index);
}
}
}
return null;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(DigitalMinerGuiMessage message, MessageContext context)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(object3D.xCoord);
dataStream.writeInt(object3D.yCoord);
dataStream.writeInt(object3D.zCoord);
dataStream.writeInt(object3D.dimensionId);
dataStream.writeInt(guiType);
if(packetType == MinerGuiPacket.CLIENT || packetType == MinerGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(windowId);
}
if(packetType == MinerGuiPacket.SERVER_INDEX || packetType == MinerGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(index);
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
packetType = MinerGuiPacket.values()[dataStream.readInt()];
object3D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiType = dataStream.readInt();
if(packetType == MinerGuiPacket.CLIENT || packetType == MinerGuiPacket.CLIENT_INDEX)
{
windowId = dataStream.readInt();
}
if(packetType == MinerGuiPacket.SERVER_INDEX || packetType == MinerGuiPacket.CLIENT_INDEX)
{
index = dataStream.readInt();
}
EntityPlayer player = PacketHandler.getPlayer(context);
if(!player.worldObj.isRemote)
{
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(object3D.dimensionId);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
if(worldServer != null && object3D.getTileEntity(worldServer) instanceof TileEntityDigitalMiner)
if(worldServer != null && message.coord4D.getTileEntity(worldServer) instanceof TileEntityDigitalMiner)
{
openServerGui(packetType, guiType, worldServer, (EntityPlayerMP)player, object3D, index);
DigitalMinerGuiMessage.openServerGui(message.packetType, message.guiType, worldServer, (EntityPlayerMP)player, message.coord4D, message.index);
}
}
else {
if(object3D.getTileEntity(player.worldObj) instanceof TileEntityDigitalMiner)
if(message.coord4D.getTileEntity(player.worldObj) instanceof TileEntityDigitalMiner)
{
try {
if(packetType == MinerGuiPacket.CLIENT)
if(message.packetType == MinerGuiPacket.CLIENT)
{
FMLCommonHandler.instance().showGuiScreen(getGui(packetType, guiType, player, player.worldObj, object3D.xCoord, object3D.yCoord, object3D.zCoord, -1));
FMLCommonHandler.instance().showGuiScreen(DigitalMinerGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.xCoord, message.coord4D.yCoord, message.coord4D.zCoord, -1));
}
else if(packetType == MinerGuiPacket.CLIENT_INDEX)
else if(message.packetType == MinerGuiPacket.CLIENT_INDEX)
{
FMLCommonHandler.instance().showGuiScreen(getGui(packetType, guiType, player, player.worldObj, object3D.xCoord, object3D.yCoord, object3D.zCoord, index));
FMLCommonHandler.instance().showGuiScreen(DigitalMinerGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.xCoord, message.coord4D.yCoord, message.coord4D.zCoord, message.index));
}
player.openContainer.windowId = windowId;
player.openContainer.windowId = message.windowId;
} catch(Exception e) {
e.printStackTrace();
}
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class DigitalMinerGuiMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum MinerGuiPacket
{
SERVER, CLIENT, SERVER_INDEX, CLIENT_INDEX
public Coord4D coord4D;
public MinerGuiPacket packetType;
public int guiType;
public int windowId = -1;
public int index = -1;
public DigitalMinerGuiMessage() {}
public DigitalMinerGuiMessage(MinerGuiPacket type, Coord4D coord, int guiID, int extra, int extra2)
{
packetType = type;
coord4D = coord;
guiType = guiID;
if(packetType == MinerGuiPacket.CLIENT)
{
windowId = extra;
}
else if(packetType == MinerGuiPacket.SERVER_INDEX)
{
index = extra;
}
else if(packetType == MinerGuiPacket.CLIENT_INDEX)
{
windowId = extra;
index = extra2;
}
}
public static void openServerGui(MinerGuiPacket t, int guiType, World world, EntityPlayerMP playerMP, Coord4D obj, int i)
{
Container container = null;
playerMP.closeContainer();
if(guiType == 0)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 4)
{
container = new ContainerDigitalMiner(playerMP.inventory, (TileEntityDigitalMiner)obj.getTileEntity(world));
}
else if(guiType == 5)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 1 || guiType == 2 || guiType == 3)
{
container = new ContainerFilter(playerMP.inventory, (TileEntityContainerBlock)obj.getTileEntity(world));
}
playerMP.getNextWindowId();
int window = playerMP.currentWindowId;
if(t == MinerGuiPacket.SERVER)
{
Mekanism.packetHandler.sendTo(new DigitalMinerGuiMessage(MinerGuiPacket.CLIENT, obj, guiType, window, 0), playerMP);
}
else if(t == MinerGuiPacket.SERVER_INDEX)
{
Mekanism.packetHandler.sendTo(new DigitalMinerGuiMessage(MinerGuiPacket.CLIENT_INDEX, obj, guiType, window, i), playerMP);
}
playerMP.openContainer = container;
playerMP.openContainer.windowId = window;
playerMP.openContainer.addCraftingToCrafters(playerMP);
if(guiType == 0)
{
TileEntityDigitalMiner tile = (TileEntityDigitalMiner)obj.getTileEntity(world);
for(EntityPlayer player : tile.playersUsing)
{
Mekanism.packetHandler.sendTo(new TileEntityMessage(obj, tile.getFilterPacket(new ArrayList())), (EntityPlayerMP)player);
}
}
}
@SideOnly(Side.CLIENT)
public static GuiScreen getGui(MinerGuiPacket packetType, int type, EntityPlayer player, World world, int x, int y, int z, int index)
{
if(type == 0)
{
return new GuiDigitalMinerConfig(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 4)
{
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 5)
{
return new GuiMFilterSelect(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else {
if(packetType == MinerGuiPacket.CLIENT)
{
if(type == 1)
{
return new GuiMItemStackFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 2)
{
return new GuiMOreDictFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
else if(type == 3)
{
return new GuiMMaterialFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z));
}
}
else if(packetType == MinerGuiPacket.CLIENT_INDEX)
{
if(type == 1)
{
return new GuiMItemStackFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z), index);
}
else if(type == 2)
{
return new GuiMOreDictFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z), index);
}
else if(type == 3)
{
return new GuiMMaterialFilter(player, (TileEntityDigitalMiner)world.getTileEntity(x, y, z), index);
}
}
}
return null;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeInt(guiType);
if(packetType == MinerGuiPacket.CLIENT || packetType == MinerGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(windowId);
}
if(packetType == MinerGuiPacket.SERVER_INDEX || packetType == MinerGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(index);
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = MinerGuiPacket.values()[dataStream.readInt()];
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiType = dataStream.readInt();
if(packetType == MinerGuiPacket.CLIENT || packetType == MinerGuiPacket.CLIENT_INDEX)
{
windowId = dataStream.readInt();
}
if(packetType == MinerGuiPacket.SERVER_INDEX || packetType == MinerGuiPacket.CLIENT_INDEX)
{
index = dataStream.readInt();
}
}
public static enum MinerGuiPacket
{
SERVER, CLIENT, SERVER_INDEX, CLIENT_INDEX
}
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.ArrayList;
@ -9,6 +8,8 @@ import mekanism.api.Coord4D;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.TransporterFilter;
@ -16,178 +17,178 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketEditFilter extends MekanismPacket
public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMessage>
{
public Coord4D coord4D;
public TransporterFilter tFilter;
public TransporterFilter tEdited;
public MinerFilter mFilter;
public MinerFilter mEdited;
public byte type = -1;
public boolean delete;
public PacketEditFilter() {}
public PacketEditFilter(Coord4D coord, boolean deletion, Object filter, Object edited)
{
coord4D = coord;
delete = deletion;
if(filter instanceof TransporterFilter)
{
tFilter = (TransporterFilter)filter;
if(!delete)
{
tEdited = (TransporterFilter)edited;
}
type = 0;
}
else if(filter instanceof MinerFilter)
{
mFilter = (MinerFilter)filter;
if(!delete)
{
mEdited = (MinerFilter)edited;
}
type = 1;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(EditFilterMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeByte(type);
dataStream.writeBoolean(delete);
ArrayList data = new ArrayList();
if(type == 0)
{
tFilter.write(data);
if(!delete)
{
tEdited.write(data);
}
}
else if(type == 1)
{
mFilter.write(data);
if(!delete)
{
mEdited.write(data);
}
}
PacketHandler.encode(data.toArray(), dataStream);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
type = dataStream.readByte();
delete = dataStream.readBoolean();
if(type == 0)
{
tFilter = TransporterFilter.readFromPacket(dataStream);
if(!delete)
{
tEdited = TransporterFilter.readFromPacket(dataStream);
}
}
else if(type == 1)
{
mFilter = MinerFilter.readFromPacket(dataStream);
if(!delete)
{
mEdited = MinerFilter.readFromPacket(dataStream);
}
}
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(coord4D.dimensionId);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
if(worldServer != null)
{
if(type == 0 && coord4D.getTileEntity(worldServer) instanceof TileEntityLogisticalSorter)
if(message.type == 0 && message.coord4D.getTileEntity(worldServer) instanceof TileEntityLogisticalSorter)
{
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter) coord4D.getTileEntity(worldServer);
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter) message.coord4D.getTileEntity(worldServer);
if(!sorter.filters.contains(tFilter))
if(!sorter.filters.contains(message.tFilter))
{
return;
return null;
}
int index = sorter.filters.indexOf(tFilter);
int index = sorter.filters.indexOf(message.tFilter);
sorter.filters.remove(index);
if(!delete)
if(!message.delete)
{
sorter.filters.add(index, tEdited);
sorter.filters.add(index, message.tEdited);
}
for(EntityPlayer iterPlayer : sorter.playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(sorter), sorter.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(sorter), sorter.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
}
}
else if(type == 1 && coord4D.getTileEntity(worldServer) instanceof TileEntityDigitalMiner)
else if(message.type == 1 && message.coord4D.getTileEntity(worldServer) instanceof TileEntityDigitalMiner)
{
TileEntityDigitalMiner miner = (TileEntityDigitalMiner) coord4D.getTileEntity(worldServer);
TileEntityDigitalMiner miner = (TileEntityDigitalMiner)message.coord4D.getTileEntity(worldServer);
if(!miner.filters.contains(mFilter))
if(!miner.filters.contains(message.mFilter))
{
return;
return null;
}
int index = miner.filters.indexOf(mFilter);
int index = miner.filters.indexOf(message.mFilter);
miner.filters.remove(index);
if(!delete)
if(!message.delete)
{
miner.filters.add(index, mEdited);
miner.filters.add(index, message.mEdited);
}
for(EntityPlayer iterPlayer : miner.playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(miner), miner.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(miner), miner.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
}
}
}
return null;
}
public static class EditFilterMessage implements IMessage
{
public Coord4D coord4D;
public TransporterFilter tFilter;
public TransporterFilter tEdited;
public MinerFilter mFilter;
public MinerFilter mEdited;
public byte type = -1;
public boolean delete;
public EditFilterMessage() {}
public EditFilterMessage(Coord4D coord, boolean deletion, Object filter, Object edited)
{
coord4D = coord;
delete = deletion;
if(filter instanceof TransporterFilter)
{
tFilter = (TransporterFilter)filter;
if(!delete)
{
tEdited = (TransporterFilter)edited;
}
type = 0;
}
else if(filter instanceof MinerFilter)
{
mFilter = (MinerFilter)filter;
if(!delete)
{
mEdited = (MinerFilter)edited;
}
type = 1;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeByte(type);
dataStream.writeBoolean(delete);
ArrayList data = new ArrayList();
if(type == 0)
{
tFilter.write(data);
if(!delete)
{
tEdited.write(data);
}
}
else if(type == 1)
{
mFilter.write(data);
if(!delete)
{
mEdited.write(data);
}
}
PacketHandler.encode(data.toArray(), dataStream);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
type = dataStream.readByte();
delete = dataStream.readBoolean();
if(type == 0)
{
tFilter = TransporterFilter.readFromPacket(dataStream);
if(!delete)
{
tEdited = TransporterFilter.readFromPacket(dataStream);
}
}
else if(type == 1)
{
mFilter = MinerFilter.readFromPacket(dataStream);
if(!delete)
{
mEdited = MinerFilter.readFromPacket(dataStream);
}
}
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,50 +1,50 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemElectricBow;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketElectricBowState.ElectricBowStateMessage;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketElectricBowState extends MekanismPacket
public class PacketElectricBowState implements IMessageHandler<ElectricBowStateMessage, IMessage>
{
public boolean fireMode;
public PacketElectricBowState() {}
public PacketElectricBowState(boolean state)
{
fireMode = state;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(ElectricBowStateMessage message, MessageContext context)
{
dataStream.writeBoolean(fireMode);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
boolean state = dataStream.readBoolean();
ItemStack itemstack = player.getCurrentEquippedItem();
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
if(itemstack != null && itemstack.getItem() instanceof ItemElectricBow)
{
((ItemElectricBow)itemstack.getItem()).setFireState(itemstack, state);
((ItemElectricBow)itemstack.getItem()).setFireState(itemstack, message.fireMode);
}
return null;
}
public static class ElectricBowStateMessage implements IMessage
{
public boolean fireMode;
public ElectricBowStateMessage() {}
public ElectricBowStateMessage(boolean state)
{
fireMode = state;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeBoolean(fireMode);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
fireMode = dataStream.readBoolean();
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.api.energy.IEnergizedItem;
import mekanism.common.IElectricChest;
@ -9,161 +8,32 @@ import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.InventoryElectricChest;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
import mekanism.common.network.PacketElectricChest.ElectricChestMessage.ElectricChestPacketType;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketElectricChest extends MekanismPacket
public class PacketElectricChest implements IMessageHandler<ElectricChestMessage, IMessage>
{
public ElectricChestPacketType activeType;
public boolean isBlock;
public boolean locked;
public String password;
public int guiType;
public int windowId;
public boolean useEnergy;
public Coord4D obj;
public PacketElectricChest() {}
//This is a really messy implementation...
public PacketElectricChest(ElectricChestPacketType type, boolean b1, boolean b2, int i1, int i2, String s1, Coord4D c1)
{
activeType = type;
switch(activeType)
{
case LOCK:
locked = b1;
isBlock = b2;
if(isBlock)
{
obj = c1;
}
break;
case PASSWORD:
password = s1;
isBlock = b1;
if(isBlock)
{
obj = c1;
}
break;
case CLIENT_OPEN:
guiType = i1;
windowId = i2;
isBlock = b1;
if(isBlock)
{
obj = c1;
}
break;
case SERVER_OPEN:
useEnergy = b1;
isBlock = b2;
if(isBlock)
{
obj = c1;
}
break;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(ElectricChestMessage message, MessageContext context)
{
dataStream.writeInt(activeType.ordinal());
switch(activeType)
{
case LOCK:
dataStream.writeBoolean(locked);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(obj.xCoord);
dataStream.writeInt(obj.yCoord);
dataStream.writeInt(obj.zCoord);
}
break;
case PASSWORD:
PacketHandler.writeString(dataStream, password);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(obj.xCoord);
dataStream.writeInt(obj.yCoord);
dataStream.writeInt(obj.zCoord);
}
break;
case CLIENT_OPEN:
dataStream.writeInt(guiType);
dataStream.writeInt(windowId);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(obj.xCoord);
dataStream.writeInt(obj.yCoord);
dataStream.writeInt(obj.zCoord);
}
break;
case SERVER_OPEN:
dataStream.writeBoolean(useEnergy);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(obj.xCoord);
dataStream.writeInt(obj.yCoord);
dataStream.writeInt(obj.zCoord);
}
break;
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
ElectricChestPacketType packetType = ElectricChestPacketType.values()[dataStream.readInt()];
if(packetType == ElectricChestPacketType.SERVER_OPEN)
EntityPlayer player = PacketHandler.getPlayer(context);
if(message.packetType == ElectricChestPacketType.SERVER_OPEN)
{
try {
boolean energy = dataStream.readBoolean();
boolean block = dataStream.readBoolean();
if(block)
if(message.isBlock)
{
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
TileEntityElectricChest tileEntity = (TileEntityElectricChest)player.worldObj.getTileEntity(x, y, z);
if(energy)
if(message.useEnergy)
{
tileEntity.setEnergy(tileEntity.getEnergy() - 100);
}
@ -175,7 +45,7 @@ public class PacketElectricChest extends MekanismPacket
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
{
if(energy)
if(message.useEnergy)
{
((IEnergizedItem)stack.getItem()).setEnergy(stack, ((IEnergizedItem)stack.getItem()).getEnergy(stack) - 100);
}
@ -189,44 +59,26 @@ public class PacketElectricChest extends MekanismPacket
e.printStackTrace();
}
}
else if(packetType == ElectricChestPacketType.CLIENT_OPEN)
else if(message.packetType == ElectricChestPacketType.CLIENT_OPEN)
{
try {
int type = dataStream.readInt();
int id = dataStream.readInt();
boolean block = dataStream.readBoolean();
int x = message.coord4D != null ? message.coord4D.xCoord : 0;
int y = message.coord4D != null ? message.coord4D.yCoord : 0;
int z = message.coord4D != null ? message.coord4D.zCoord : 0;
int x = 0;
int y = 0;
int z = 0;
if(block)
{
x = dataStream.readInt();
y = dataStream.readInt();
z = dataStream.readInt();
}
Mekanism.proxy.openElectricChest(player, type, id, block, x, y, z);
Mekanism.proxy.openElectricChest(player, message.guiType, message.windowId, message.isBlock, x, y, z);
} catch(Exception e) {
Mekanism.logger.error("Error while handling electric chest open packet.");
e.printStackTrace();
}
}
else if(packetType == ElectricChestPacketType.PASSWORD)
else if(message.packetType == ElectricChestPacketType.PASSWORD)
{
try {
String pass = PacketHandler.readString(dataStream);
boolean block = dataStream.readBoolean();
if(block)
if(message.isBlock)
{
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
TileEntityElectricChest tileEntity = (TileEntityElectricChest)player.worldObj.getTileEntity(x, y, z);
tileEntity.password = pass;
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
tileEntity.password = message.password;
tileEntity.authenticated = true;
}
else {
@ -234,7 +86,7 @@ public class PacketElectricChest extends MekanismPacket
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
{
((IElectricChest)stack.getItem()).setPassword(stack, pass);
((IElectricChest)stack.getItem()).setPassword(stack, message.password);
((IElectricChest)stack.getItem()).setAuthenticated(stack, true);
}
}
@ -243,27 +95,20 @@ public class PacketElectricChest extends MekanismPacket
e.printStackTrace();
}
}
else if(packetType == ElectricChestPacketType.LOCK)
else if(message.packetType == ElectricChestPacketType.LOCK)
{
try {
boolean lock = dataStream.readBoolean();
boolean block = dataStream.readBoolean();
if(block)
if(message.isBlock)
{
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
TileEntityElectricChest tileEntity = (TileEntityElectricChest)player.worldObj.getTileEntity(x, y, z);
tileEntity.locked = lock;
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
tileEntity.locked = message.locked;
}
else {
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
{
((IElectricChest)stack.getItem()).setLocked(stack, lock);
((IElectricChest)stack.getItem()).setLocked(stack, message.locked);
}
}
} catch(Exception e) {
@ -271,25 +116,197 @@ public class PacketElectricChest extends MekanismPacket
e.printStackTrace();
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class ElectricChestMessage implements IMessage
{
public ElectricChestPacketType packetType;
public boolean isBlock;
public boolean locked;
public String password;
public int guiType;
public int windowId;
public boolean useEnergy;
public Coord4D coord4D;
public ElectricChestMessage() {}
//This is a really messy implementation...
public ElectricChestMessage(ElectricChestPacketType type, boolean b1, boolean b2, int i1, int i2, String s1, Coord4D c1)
{
packetType = type;
switch(packetType)
{
case LOCK:
locked = b1;
isBlock = b2;
if(isBlock)
{
coord4D = c1;
}
break;
case PASSWORD:
password = s1;
isBlock = b1;
if(isBlock)
{
coord4D = c1;
}
break;
case CLIENT_OPEN:
guiType = i1;
windowId = i2;
isBlock = b1;
if(isBlock)
{
coord4D = c1;
}
break;
case SERVER_OPEN:
useEnergy = b1;
isBlock = b2;
if(isBlock)
{
coord4D = c1;
}
break;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
switch(packetType)
{
case LOCK:
dataStream.writeBoolean(locked);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
break;
case PASSWORD:
PacketHandler.writeString(dataStream, password);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
break;
case CLIENT_OPEN:
dataStream.writeInt(guiType);
dataStream.writeInt(windowId);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
break;
case SERVER_OPEN:
dataStream.writeBoolean(useEnergy);
dataStream.writeBoolean(isBlock);
if(isBlock)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
break;
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = ElectricChestPacketType.values()[dataStream.readInt()];
if(packetType == ElectricChestPacketType.SERVER_OPEN)
{
useEnergy = dataStream.readBoolean();
isBlock = dataStream.readBoolean();
}
if(isBlock)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
}
else if(packetType == ElectricChestPacketType.CLIENT_OPEN)
{
guiType = dataStream.readInt();
windowId = dataStream.readInt();
isBlock = dataStream.readBoolean();
@Override
public void handleServerSide(EntityPlayer player)
{
if(isBlock)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
}
else if(packetType == ElectricChestPacketType.PASSWORD)
{
password = PacketHandler.readString(dataStream);
isBlock = dataStream.readBoolean();
}
if(isBlock)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
}
else if(packetType == ElectricChestPacketType.LOCK)
{
locked = dataStream.readBoolean();
isBlock = dataStream.readBoolean();
public static enum ElectricChestPacketType
{
LOCK,
PASSWORD,
CLIENT_OPEN,
SERVER_OPEN
if(isBlock)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
}
}
public static enum ElectricChestPacketType
{
LOCK,
PASSWORD,
CLIENT_OPEN,
SERVER_OPEN
}
}
}

View file

@ -1,89 +1,40 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemJetpack;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage;
import mekanism.common.network.PacketJetpackData.JetpackDataMessage.JetpackPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketJetpackData extends MekanismPacket
public class PacketJetpackData implements IMessageHandler<JetpackDataMessage, IMessage>
{
public JetpackPacket packetType;
public String username;
public boolean value;
public PacketJetpackData() {}
public PacketJetpackData(JetpackPacket type, String name, boolean state)
{
packetType = type;
if(packetType == JetpackPacket.UPDATE)
{
username = name;
value = state;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(JetpackDataMessage message, MessageContext context)
{
dataStream.writeInt(packetType.ordinal());
if(packetType == JetpackPacket.UPDATE)
EntityPlayer player = PacketHandler.getPlayer(context);
if(message.packetType == JetpackPacket.UPDATE)
{
PacketHandler.writeString(dataStream, username);
dataStream.writeBoolean(value);
}
else if(packetType == JetpackPacket.FULL)
{
dataStream.writeInt(Mekanism.jetpackOn.size());
for(String username : Mekanism.jetpackOn)
if(message.value)
{
PacketHandler.writeString(dataStream, username);
}
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
packetType = JetpackPacket.values()[dataStream.readInt()];
if(packetType == JetpackPacket.FULL)
{
Mekanism.jetpackOn.clear();
int amount = dataStream.readInt();
for(int i = 0; i < amount; i++)
{
Mekanism.jetpackOn.add(PacketHandler.readString(dataStream));
}
}
else if(packetType == JetpackPacket.UPDATE)
{
String username = PacketHandler.readString(dataStream);
boolean value = dataStream.readBoolean();
if(value)
{
Mekanism.jetpackOn.add(username);
Mekanism.jetpackOn.add(message.username);
}
else {
Mekanism.jetpackOn.remove(username);
Mekanism.jetpackOn.remove(message.username);
}
if(!player.worldObj.isRemote)
{
Mekanism.packetPipeline.sendToDimension(new PacketJetpackData(JetpackPacket.UPDATE, username, value), player.worldObj.provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new JetpackDataMessage(JetpackPacket.UPDATE, message.username, message.value), player.worldObj.provider.dimensionId);
}
}
else if(packetType == JetpackPacket.MODE)
else if(message.packetType == JetpackPacket.MODE)
{
ItemStack stack = player.getEquipmentInSlot(3);
@ -92,24 +43,79 @@ public class PacketJetpackData extends MekanismPacket
((ItemJetpack)stack.getItem()).incrementMode(stack);
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class JetpackDataMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum JetpackPacket
{
UPDATE,
FULL,
MODE;
public JetpackPacket packetType;
public String username;
public boolean value;
public JetpackDataMessage() {}
public JetpackDataMessage(JetpackPacket type, String name, boolean state)
{
packetType = type;
if(packetType == JetpackPacket.UPDATE)
{
username = name;
value = state;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
if(packetType == JetpackPacket.UPDATE)
{
PacketHandler.writeString(dataStream, username);
dataStream.writeBoolean(value);
}
else if(packetType == JetpackPacket.FULL)
{
dataStream.writeInt(Mekanism.jetpackOn.size());
for(String username : Mekanism.jetpackOn)
{
PacketHandler.writeString(dataStream, username);
}
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = JetpackPacket.values()[dataStream.readInt()];
if(packetType == JetpackPacket.FULL)
{
Mekanism.jetpackOn.clear();
int amount = dataStream.readInt();
for(int i = 0; i < amount; i++)
{
Mekanism.jetpackOn.add(PacketHandler.readString(dataStream));
}
}
else if(packetType == JetpackPacket.UPDATE)
{
username = PacketHandler.readString(dataStream);
value = dataStream.readBoolean();
}
}
public static enum JetpackPacket
{
UPDATE,
FULL,
MODE;
}
}
}

View file

@ -1,54 +1,54 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.Mekanism;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketKey.KeyMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketKey extends MekanismPacket
public class PacketKey implements IMessageHandler<KeyMessage, IMessage>
{
public int key;
public boolean add;
public PacketKey() {}
public PacketKey(int k, boolean a)
{
key = k;
add = a;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(KeyMessage message, MessageContext context)
{
dataStream.writeInt(key);
dataStream.writeBoolean(add);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
key = dataStream.readInt();
add = dataStream.readBoolean();
if(add)
if(message.add)
{
Mekanism.keyMap.add(player, key);
Mekanism.keyMap.add(PacketHandler.getPlayer(context), message.key);
}
else {
Mekanism.keyMap.remove(player, key);
Mekanism.keyMap.remove(PacketHandler.getPlayer(context), message.key);
}
return null;
}
public static class KeyMessage implements IMessage
{
public int key;
public boolean add;
public KeyMessage() {}
public KeyMessage(int k, boolean a)
{
key = k;
add = a;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(key);
dataStream.writeBoolean(add);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
key = dataStream.readInt();
add = dataStream.readBoolean();
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.client.gui.GuiLogisticalSorter;
import mekanism.client.gui.GuiTFilterSelect;
@ -9,8 +8,11 @@ import mekanism.client.gui.GuiTItemStackFilter;
import mekanism.client.gui.GuiTMaterialFilter;
import mekanism.client.gui.GuiTOreDictFilter;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage.SorterGuiPacket;
import mekanism.common.tile.TileEntityContainerBlock;
import mekanism.common.tile.TileEntityLogisticalSorter;
import net.minecraft.client.gui.GuiScreen;
@ -19,215 +21,217 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PacketLogisticalSorterGui extends MekanismPacket
public class PacketLogisticalSorterGui implements IMessageHandler<LogisticalSorterGuiMessage, IMessage>
{
public Coord4D object3D;
public SorterGuiPacket packetType;
public int guiType;
public int windowId = -1;
public int index = -1;
public PacketLogisticalSorterGui() {}
public PacketLogisticalSorterGui(SorterGuiPacket type, Coord4D coord, int guiId, int extra, int extra2)
{
packetType = type;
object3D = coord;
guiType = guiId;
if(packetType == SorterGuiPacket.CLIENT)
{
windowId = extra;
}
else if(packetType == SorterGuiPacket.SERVER_INDEX)
{
index = extra;
}
else if(packetType == SorterGuiPacket.CLIENT_INDEX)
{
windowId = extra2;
index = extra2;
}
}
public static void openServerGui(SorterGuiPacket t, int guiType, World world, EntityPlayerMP playerMP, Coord4D obj, int i)
{
Container container = null;
playerMP.closeContainer();
if(guiType == 0)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 4)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 1 || guiType == 2 || guiType == 3)
{
container = new ContainerFilter(playerMP.inventory, (TileEntityContainerBlock)obj.getTileEntity(world));
}
playerMP.getNextWindowId();
int window = playerMP.currentWindowId;
if(t == SorterGuiPacket.SERVER)
{
Mekanism.packetPipeline.sendTo(new PacketLogisticalSorterGui(SorterGuiPacket.CLIENT, obj, guiType, window, 0), playerMP);
}
else if(t == SorterGuiPacket.SERVER_INDEX)
{
Mekanism.packetPipeline.sendTo(new PacketLogisticalSorterGui(SorterGuiPacket.CLIENT_INDEX, obj, guiType, window, i), playerMP);
}
playerMP.openContainer = container;
playerMP.openContainer.windowId = window;
playerMP.openContainer.addCraftingToCrafters(playerMP);
}
@SideOnly(Side.CLIENT)
public GuiScreen getGui(SorterGuiPacket packetType, int type, EntityPlayer player, World world, int x, int y, int z, int index)
{
if(type == 0)
{
return new GuiLogisticalSorter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else if(type == 4)
{
return new GuiTFilterSelect(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else {
if(packetType == SorterGuiPacket.CLIENT)
{
if(type == 1)
{
return new GuiTItemStackFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else if(type == 2)
{
return new GuiTOreDictFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else if(type == 3)
{
return new GuiTMaterialFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
}
else if(packetType == SorterGuiPacket.CLIENT_INDEX)
{
if(type == 1)
{
return new GuiTItemStackFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z), index);
}
else if(type == 2)
{
return new GuiTOreDictFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z), index);
}
else if(type == 3)
{
return new GuiTMaterialFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z), index);
}
}
}
return null;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(LogisticalSorterGuiMessage message, MessageContext context)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(object3D.xCoord);
dataStream.writeInt(object3D.yCoord);
dataStream.writeInt(object3D.zCoord);
dataStream.writeInt(object3D.dimensionId);
dataStream.writeInt(guiType);
if(packetType == SorterGuiPacket.CLIENT || packetType == SorterGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(windowId);
}
if(packetType == SorterGuiPacket.SERVER_INDEX || packetType == SorterGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(index);
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
packetType = SorterGuiPacket.values()[dataStream.readInt()];
object3D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiType = dataStream.readInt();
if(packetType == SorterGuiPacket.CLIENT || packetType == SorterGuiPacket.CLIENT_INDEX)
{
windowId = dataStream.readInt();
}
if(packetType == SorterGuiPacket.SERVER_INDEX || packetType == SorterGuiPacket.CLIENT_INDEX)
{
index = dataStream.readInt();
}
EntityPlayer player = PacketHandler.getPlayer(context);
if(!player.worldObj.isRemote)
{
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(object3D.dimensionId);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.object3D.dimensionId);
if(worldServer != null && object3D.getTileEntity(worldServer) instanceof TileEntityLogisticalSorter)
if(worldServer != null && message.object3D.getTileEntity(worldServer) instanceof TileEntityLogisticalSorter)
{
openServerGui(packetType, guiType, worldServer, (EntityPlayerMP)player, object3D, index);
LogisticalSorterGuiMessage.openServerGui(message.packetType, message.guiType, worldServer, (EntityPlayerMP)player, message.object3D, message.index);
}
}
else {
if(object3D.getTileEntity(player.worldObj) instanceof TileEntityLogisticalSorter)
if(message.object3D.getTileEntity(player.worldObj) instanceof TileEntityLogisticalSorter)
{
try {
if(packetType == SorterGuiPacket.CLIENT)
if(message.packetType == SorterGuiPacket.CLIENT)
{
FMLCommonHandler.instance().showGuiScreen(getGui(packetType, guiType, player, player.worldObj, object3D.xCoord, object3D.yCoord, object3D.zCoord, -1));
FMLCommonHandler.instance().showGuiScreen(LogisticalSorterGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.object3D.xCoord, message.object3D.yCoord, message.object3D.zCoord, -1));
}
else if(packetType == SorterGuiPacket.CLIENT_INDEX)
else if(message.packetType == SorterGuiPacket.CLIENT_INDEX)
{
FMLCommonHandler.instance().showGuiScreen(getGui(packetType, guiType, player, player.worldObj, object3D.xCoord, object3D.yCoord, object3D.zCoord, index));
FMLCommonHandler.instance().showGuiScreen(LogisticalSorterGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.object3D.xCoord, message.object3D.yCoord, message.object3D.zCoord, message.index));
}
player.openContainer.windowId = windowId;
player.openContainer.windowId = message.windowId;
} catch(Exception e) {
e.printStackTrace();
}
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class LogisticalSorterGuiMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum SorterGuiPacket
{
SERVER, CLIENT, SERVER_INDEX, CLIENT_INDEX
public Coord4D object3D;
public SorterGuiPacket packetType;
public int guiType;
public int windowId = -1;
public int index = -1;
public LogisticalSorterGuiMessage() {}
public LogisticalSorterGuiMessage(SorterGuiPacket type, Coord4D coord, int guiId, int extra, int extra2)
{
packetType = type;
object3D = coord;
guiType = guiId;
if(packetType == SorterGuiPacket.CLIENT)
{
windowId = extra;
}
else if(packetType == SorterGuiPacket.SERVER_INDEX)
{
index = extra;
}
else if(packetType == SorterGuiPacket.CLIENT_INDEX)
{
windowId = extra2;
index = extra2;
}
}
public static void openServerGui(SorterGuiPacket t, int guiType, World world, EntityPlayerMP playerMP, Coord4D obj, int i)
{
Container container = null;
playerMP.closeContainer();
if(guiType == 0)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 4)
{
container = new ContainerNull(playerMP, (TileEntityContainerBlock)obj.getTileEntity(world));
}
else if(guiType == 1 || guiType == 2 || guiType == 3)
{
container = new ContainerFilter(playerMP.inventory, (TileEntityContainerBlock)obj.getTileEntity(world));
}
playerMP.getNextWindowId();
int window = playerMP.currentWindowId;
if(t == SorterGuiPacket.SERVER)
{
Mekanism.packetHandler.sendTo(new LogisticalSorterGuiMessage(SorterGuiPacket.CLIENT, obj, guiType, window, 0), playerMP);
}
else if(t == SorterGuiPacket.SERVER_INDEX)
{
Mekanism.packetHandler.sendTo(new LogisticalSorterGuiMessage(SorterGuiPacket.CLIENT_INDEX, obj, guiType, window, i), playerMP);
}
playerMP.openContainer = container;
playerMP.openContainer.windowId = window;
playerMP.openContainer.addCraftingToCrafters(playerMP);
}
@SideOnly(Side.CLIENT)
public static GuiScreen getGui(SorterGuiPacket packetType, int type, EntityPlayer player, World world, int x, int y, int z, int index)
{
if(type == 0)
{
return new GuiLogisticalSorter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else if(type == 4)
{
return new GuiTFilterSelect(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else {
if(packetType == SorterGuiPacket.CLIENT)
{
if(type == 1)
{
return new GuiTItemStackFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else if(type == 2)
{
return new GuiTOreDictFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
else if(type == 3)
{
return new GuiTMaterialFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z));
}
}
else if(packetType == SorterGuiPacket.CLIENT_INDEX)
{
if(type == 1)
{
return new GuiTItemStackFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z), index);
}
else if(type == 2)
{
return new GuiTOreDictFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z), index);
}
else if(type == 3)
{
return new GuiTMaterialFilter(player, (TileEntityLogisticalSorter)world.getTileEntity(x, y, z), index);
}
}
}
return null;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(object3D.xCoord);
dataStream.writeInt(object3D.yCoord);
dataStream.writeInt(object3D.zCoord);
dataStream.writeInt(object3D.dimensionId);
dataStream.writeInt(guiType);
if(packetType == SorterGuiPacket.CLIENT || packetType == SorterGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(windowId);
}
if(packetType == SorterGuiPacket.SERVER_INDEX || packetType == SorterGuiPacket.CLIENT_INDEX)
{
dataStream.writeInt(index);
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = SorterGuiPacket.values()[dataStream.readInt()];
object3D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiType = dataStream.readInt();
if(packetType == SorterGuiPacket.CLIENT || packetType == SorterGuiPacket.CLIENT_INDEX)
{
windowId = dataStream.readInt();
}
if(packetType == SorterGuiPacket.SERVER_INDEX || packetType == SorterGuiPacket.CLIENT_INDEX)
{
index = dataStream.readInt();
}
}
public static enum SorterGuiPacket
{
SERVER, CLIENT, SERVER_INDEX, CLIENT_INDEX
}
}
}

View file

@ -1,7 +1,6 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.ArrayList;
@ -9,6 +8,8 @@ import mekanism.api.Coord4D;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.transporter.TransporterFilter;
@ -16,106 +17,113 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketNewFilter extends MekanismPacket
public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessage>
{
public Coord4D coord4D;
public TransporterFilter tFilter;
public MinerFilter mFilter;
public byte type = -1;
public PacketNewFilter() {}
public PacketNewFilter(Coord4D coord, Object filter)
{
coord4D = coord;
if(filter instanceof TransporterFilter)
{
tFilter = (TransporterFilter)filter;
type = 0;
}
else if(filter instanceof MinerFilter)
{
mFilter = (MinerFilter)filter;
type = 1;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(NewFilterMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeByte(type);
ArrayList data = new ArrayList();
if(type == 0)
{
tFilter.write(data);
}
else if(type == 1)
{
mFilter.write(data);
}
PacketHandler.encode(data.toArray(), dataStream);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
type = dataStream.readByte();
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(coord4D.dimensionId);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
if(worldServer != null)
{
if(type == 0 && coord4D.getTileEntity(worldServer) instanceof TileEntityLogisticalSorter)
if(message.type == 0 && message.coord4D.getTileEntity(worldServer) instanceof TileEntityLogisticalSorter)
{
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter) coord4D.getTileEntity(worldServer);
TransporterFilter filter = TransporterFilter.readFromPacket(dataStream);
TileEntityLogisticalSorter sorter = (TileEntityLogisticalSorter)message.coord4D.getTileEntity(worldServer);
sorter.filters.add(filter);
sorter.filters.add(message.tFilter);
for(EntityPlayer iterPlayer : sorter.playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(sorter), sorter.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(sorter), sorter.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
}
}
else if(type == 1 && coord4D.getTileEntity(worldServer) instanceof TileEntityDigitalMiner)
else if(message.type == 1 && message.coord4D.getTileEntity(worldServer) instanceof TileEntityDigitalMiner)
{
TileEntityDigitalMiner miner = (TileEntityDigitalMiner) coord4D.getTileEntity(worldServer);
MinerFilter filter = MinerFilter.readFromPacket(dataStream);
TileEntityDigitalMiner miner = (TileEntityDigitalMiner)message.coord4D.getTileEntity(worldServer);
miner.filters.add(filter);
miner.filters.add(message.mFilter);
for(EntityPlayer iterPlayer : miner.playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(miner), miner.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(miner), miner.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
}
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class NewFilterMessage implements IMessage
{
public Coord4D coord4D;
}
public TransporterFilter tFilter;
@Override
public void handleServerSide(EntityPlayer player)
{
public MinerFilter mFilter;
public byte type = -1;
public NewFilterMessage() {}
public NewFilterMessage(Coord4D coord, Object filter)
{
coord4D = coord;
if(filter instanceof TransporterFilter)
{
tFilter = (TransporterFilter)filter;
type = 0;
}
else if(filter instanceof MinerFilter)
{
mFilter = (MinerFilter)filter;
type = 1;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeByte(type);
ArrayList data = new ArrayList();
if(type == 0)
{
tFilter.write(data);
}
else if(type == 1)
{
mFilter.write(data);
}
PacketHandler.encode(data.toArray(), dataStream);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
type = dataStream.readByte();
if(type == 0)
{
tFilter = TransporterFilter.readFromPacket(dataStream);
}
else if(type == 1)
{
mFilter = MinerFilter.readFromPacket(dataStream);
}
}
}
}

View file

@ -1,290 +0,0 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Packet pipeline class. Directs all registered packet data to be handled by
* the packets themselves.
*
* @author unpairedbracket based on sirgingalot's tutorial
*/
@ChannelHandler.Sharable
public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, MekanismPacket>
{
private EnumMap<Side, FMLEmbeddedChannel> channels;
private LinkedList<Class<? extends MekanismPacket>> packets = new LinkedList<Class<? extends MekanismPacket>>();
private boolean isPostInitialised = false;
/**
* Register your packet with the pipeline. Discriminators are automatically
* set.
*
* @param clazz - the class to register
*
* @return whether registration was successful. Failure may occur if 256
* packets have been registered or if the registry already contains
* this packet
*/
public boolean registerPacket(Class<? extends MekanismPacket> clazz)
{
if(packets.size() > 256)
{
// You should log here!!
return false;
}
if(packets.contains(clazz))
{
// You should log here!!
return false;
}
if(isPostInitialised)
{
// You should log here!!
return false;
}
packets.add(clazz);
return true;
}
// In line encoding of the packet, including discriminator setting
@Override
protected void encode(ChannelHandlerContext ctx, MekanismPacket msg, List<Object> out) throws Exception
{
ByteBuf buffer = Unpooled.buffer();
Class<? extends MekanismPacket> clazz = msg.getClass();
if(!packets.contains(msg.getClass()))
{
throw new NullPointerException("No Packet Registered for: " + msg.getClass().getCanonicalName());
}
byte discriminator = (byte)packets.indexOf(clazz);
buffer.writeByte(discriminator);
msg.write(ctx, buffer);
FMLProxyPacket proxyPacket = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
out.add(proxyPacket);
}
// In line decoding and handling of the packet
@Override
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception
{
ByteBuf payload = msg.payload();
byte discriminator = payload.readByte();
Class<? extends MekanismPacket> clazz = packets.get(discriminator);
if(clazz == null)
{
throw new NullPointerException("No packet registered for discriminator: " + discriminator);
}
EntityPlayer player = null;
switch(FMLCommonHandler.instance().getEffectiveSide())
{
case CLIENT:
player = getClientPlayer();
break;
case SERVER:
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
player = ((NetHandlerPlayServer)netHandler).playerEntity;
break;
}
MekanismPacket pkt = clazz.newInstance();
pkt.read(ctx, player, payload.slice());
switch(FMLCommonHandler.instance().getEffectiveSide())
{
case CLIENT:
pkt.handleClientSide(player);
break;
case SERVER:
pkt.handleServerSide(player);
break;
}
out.add(pkt);
}
// Method to call from FMLInitializationEvent
public void initialize()
{
channels = NetworkRegistry.INSTANCE.newChannel("MEK", this);
registerPackets();
}
public void registerPackets()
{
//Packet registrations
registerPacket(PacketRobit.class);
registerPacket(PacketTransmitterUpdate.class);
registerPacket(PacketElectricChest.class);
registerPacket(PacketElectricBowState.class);
registerPacket(PacketConfiguratorState.class);
registerPacket(PacketTileEntity.class);
registerPacket(PacketPortalFX.class);
registerPacket(PacketDataRequest.class);
registerPacket(PacketStatusUpdate.class);
registerPacket(PacketDigitUpdate.class);
registerPacket(PacketPortableTeleport.class);
registerPacket(PacketRemoveUpgrade.class);
registerPacket(PacketRedstoneControl.class);
registerPacket(PacketWalkieTalkieState.class);
registerPacket(PacketLogisticalSorterGui.class);
registerPacket(PacketNewFilter.class);
registerPacket(PacketEditFilter.class);
registerPacket(PacketConfigurationUpdate.class);
registerPacket(PacketSimpleGui.class);
registerPacket(PacketDigitalMinerGui.class);
registerPacket(PacketJetpackData.class);
registerPacket(PacketKey.class);
registerPacket(PacketScubaTankData.class);
registerPacket(PacketConfigSync.class);
registerPacket(PacketBoxBlacklist.class);
}
// Method to call from FMLPostInitializationEvent
// Ensures that packet discriminators are common between server and client
// by using logical sorting
public void postInitialize()
{
if(isPostInitialised)
{
return;
}
isPostInitialised = true;
Collections.sort(packets, new Comparator<Class<? extends MekanismPacket>>() {
@Override
public int compare(Class<? extends MekanismPacket> clazz1, Class<? extends MekanismPacket> clazz2)
{
int com = String.CASE_INSENSITIVE_ORDER.compare(clazz1.getCanonicalName(), clazz2.getCanonicalName());
if(com == 0)
{
com = clazz1.getCanonicalName().compareTo(clazz2.getCanonicalName());
}
return com;
}
});
}
@SideOnly(Side.CLIENT)
private EntityPlayer getClientPlayer()
{
return Minecraft.getMinecraft().thePlayer;
}
/**
* Send this message to everyone.
* @param message - the message to send
*/
public void sendToAll(MekanismPacket message)
{
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
channels.get(Side.SERVER).writeAndFlush(message);
}
/**
* Send this message to the specified player.
* @param message - the message to send
* @param player - the player to send it to
*/
public void sendTo(MekanismPacket message, EntityPlayerMP player)
{
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
channels.get(Side.SERVER).writeAndFlush(message);
}
/**
* Send this message to everyone within a certain range of a point.
*
* @param message - the message to send
* @param point - the TargetPoint around which to send
*/
public void sendToAllAround(MekanismPacket message, NetworkRegistry.TargetPoint point)
{
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
channels.get(Side.SERVER).writeAndFlush(message);
}
/**
* Send this message to everyone within the supplied dimension.
* @param message - the message to send
* @param dimensionId - the dimension id to target
*/
public void sendToDimension(MekanismPacket message, int dimensionId)
{
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.DIMENSION);
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId);
channels.get(Side.SERVER).writeAndFlush(message);
}
/**
* Send this message to the server.
* @param message - the message to send
*/
public void sendToServer(MekanismPacket message)
{
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER);
channels.get(Side.CLIENT).writeAndFlush(message);
}
/**
* Send this message to all players within a defined AABB cuboid.
* @param message - the message to send
* @param cuboid - the AABB cuboid to send the packet in
* @param dimId - the dimension the cuboid is in
*/
public void sendToCuboid(MekanismPacket message, AxisAlignedBB cuboid, int dimId)
{
MinecraftServer server = MinecraftServer.getServer();
if(server != null && cuboid != null)
{
for(EntityPlayerMP player : (List<EntityPlayerMP>)server.getConfigurationManager().playerEntityList)
{
if(cuboid.isVecInside(Vec3.createVectorHelper(player.posX, player.posY, player.posZ)))
{
sendTo(message, player);
}
}
}
}
}

View file

@ -1,12 +1,14 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.common.Mekanism;
import mekanism.common.ObfuscatedNames;
import mekanism.common.PacketHandler;
import mekanism.common.Teleporter;
import mekanism.common.item.ItemPortableTeleporter;
import mekanism.common.network.PacketPortableTeleport.PortableTeleportMessage;
import mekanism.common.network.PacketPortalFX.PortalFXMessage;
import mekanism.common.tile.TileEntityTeleporter;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
@ -15,32 +17,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketPortableTeleport extends MekanismPacket
public class PacketPortableTeleport implements IMessageHandler<PortableTeleportMessage, IMessage>
{
public PacketPortableTeleport() {}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf buffer)
{
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf buffer)
{
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
public IMessage onMessage(PortableTeleportMessage message, MessageContext context)
{
EntityPlayer player = PacketHandler.getPlayer(context);
ItemStack itemstack = player.getCurrentEquippedItem();
World world = player.worldObj;
@ -76,10 +62,29 @@ public class PacketPortableTeleport extends MekanismPacket
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(coords.xCoord+0.5, coords.yCoord+1, coords.zCoord+0.5, player.rotationYaw, player.rotationPitch);
world.playSoundAtEntity(player, "mob.endermen.portal", 1.0F, 1.0F);
Mekanism.packetPipeline.sendToAllAround(new PacketPortalFX(coords), coords.getTargetPoint(40D));
Mekanism.packetHandler.sendToAllAround(new PortalFXMessage(coords), coords.getTargetPoint(40D));
} catch(Exception e) {}
}
}
}
return null;
}
public static class PortableTeleportMessage implements IMessage
{
public PortableTeleportMessage() {}
@Override
public void toBytes(ByteBuf buffer)
{
}
@Override
public void fromBytes(ByteBuf buffer)
{
}
}
}

View file

@ -1,57 +1,59 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.Random;
import mekanism.api.Coord4D;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketPortalFX.PortalFXMessage;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketPortalFX extends MekanismPacket
public class PacketPortalFX implements IMessageHandler<PortalFXMessage, IMessage>
{
public Coord4D coord4D;
public PacketPortalFX() {}
public PacketPortalFX(Coord4D coord)
{
coord4D = coord;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
public IMessage onMessage(PortalFXMessage message, MessageContext context)
{
EntityPlayer player = PacketHandler.getPlayer(context);
Random random = new Random();
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
for(int i = 0; i < 50; i++)
{
player.worldObj.spawnParticle("portal", x + random.nextFloat(), y + random.nextFloat(), z + random.nextFloat(), 0.0F, 0.0F, 0.0F);
player.worldObj.spawnParticle("portal", x + random.nextFloat(), y + 1 + random.nextFloat(), z + random.nextFloat(), 0.0F, 0.0F, 0.0F);
player.worldObj.spawnParticle("portal", message.coord4D.xCoord + random.nextFloat(), message.coord4D.yCoord + random.nextFloat(), message.coord4D.zCoord + random.nextFloat(), 0.0F, 0.0F, 0.0F);
player.worldObj.spawnParticle("portal", message.coord4D.xCoord + random.nextFloat(), message.coord4D.yCoord + 1 + random.nextFloat(), message.coord4D.zCoord + random.nextFloat(), 0.0F, 0.0F, 0.0F);
}
return null;
}
public static class PortalFXMessage implements IMessage
{
public Coord4D coord4D;
public PortalFXMessage() {}
public PortalFXMessage(Coord4D coord)
{
coord4D = coord;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,60 +1,62 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.common.IRedstoneControl;
import mekanism.common.IRedstoneControl.RedstoneControl;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketRedstoneControl.RedstoneControlMessage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketRedstoneControl extends MekanismPacket
public class PacketRedstoneControl implements IMessageHandler<RedstoneControlMessage, IMessage>
{
public Coord4D coord4D;
public RedstoneControl value;
public PacketRedstoneControl() {}
public PacketRedstoneControl(Coord4D coord, RedstoneControl control)
{
coord4D = coord;
value = control;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(RedstoneControlMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeInt(value.ordinal());
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
Coord4D obj = Coord4D.read(dataStream);
RedstoneControl control = RedstoneControl.values()[dataStream.readInt()];
TileEntity tileEntity = obj.getTileEntity(player.worldObj);
EntityPlayer player = PacketHandler.getPlayer(context);
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity instanceof IRedstoneControl)
{
((IRedstoneControl)tileEntity).setControlType(control);
((IRedstoneControl)tileEntity).setControlType(message.value);
}
return null;
}
public static class RedstoneControlMessage implements IMessage
{
public Coord4D coord4D;
public RedstoneControl value;
public RedstoneControlMessage() {}
public RedstoneControlMessage(Coord4D coord, RedstoneControl control)
{
coord4D = coord;
value = control;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeInt(value.ordinal());
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = Coord4D.read(dataStream);
value = RedstoneControl.values()[dataStream.readInt()];
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,55 +1,32 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.common.IUpgradeManagement;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketRemoveUpgrade.RemoveUpgradeMessage;
import mekanism.common.tile.TileEntityBasicBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketRemoveUpgrade extends MekanismPacket
public class PacketRemoveUpgrade implements IMessageHandler<RemoveUpgradeMessage, IMessage>
{
public Coord4D coord4D;
public byte upgradeType;
public PacketRemoveUpgrade() {}
public PacketRemoveUpgrade(Coord4D coord, byte type)
{
coord4D = coord;
upgradeType = type;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(RemoveUpgradeMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeByte(upgradeType);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
byte type = dataStream.readByte();
TileEntity tileEntity = player.worldObj.getTileEntity(x, y, z);
EntityPlayer player = PacketHandler.getPlayer(context);
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity instanceof IUpgradeManagement && tileEntity instanceof TileEntityBasicBlock)
{
IUpgradeManagement upgradeTile = (IUpgradeManagement)tileEntity;
if(type == 0)
if(message.upgradeType == 0)
{
if(upgradeTile.getSpeedMultiplier() > 0)
{
@ -59,7 +36,7 @@ public class PacketRemoveUpgrade extends MekanismPacket
}
}
}
else if(type == 1)
else if(message.upgradeType == 1)
{
if(upgradeTile.getEnergyMultiplier() > 0)
{
@ -70,17 +47,41 @@ public class PacketRemoveUpgrade extends MekanismPacket
}
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class RemoveUpgradeMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
public Coord4D coord4D;
public byte upgradeType;
public RemoveUpgradeMessage() {}
public RemoveUpgradeMessage(Coord4D coord, byte type)
{
coord4D = coord;
upgradeType = type;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeByte(upgradeType);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
upgradeType = dataStream.readByte();
}
}
}

View file

@ -1,172 +1,186 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.entity.EntityRobit;
import mekanism.common.network.PacketRobit.RobitMessage;
import mekanism.common.network.PacketRobit.RobitMessage.RobitPacketType;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketRobit extends MekanismPacket
public class PacketRobit implements IMessageHandler<RobitMessage, IMessage>
{
public RobitPacketType activeType;
public int guiType;
public int entityId;
public String name;
public PacketRobit() {}
public PacketRobit(RobitPacketType type, int i1, int i2, String s)
{
activeType = type;
switch(activeType)
{
case GUI:
guiType = i1;
entityId = i2;
break;
case FOLLOW:
entityId = i1;
break;
case NAME:
name = s;
entityId = i1;
break;
case GO_HOME:
entityId = i1;
break;
case DROP_PICKUP:
entityId = i1;
break;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(RobitMessage message, MessageContext context)
{
dataStream.writeInt(activeType.ordinal());
switch(activeType)
EntityPlayer player = PacketHandler.getPlayer(context);
if(message.activeType == RobitPacketType.GUI)
{
case GUI:
dataStream.writeInt(guiType);
dataStream.writeInt(entityId);
break;
case FOLLOW:
dataStream.writeInt(entityId);
break;
case NAME:
PacketHandler.writeString(dataStream, name);
dataStream.writeInt(entityId);
break;
case GO_HOME:
dataStream.writeInt(entityId);
break;
case DROP_PICKUP:
dataStream.writeInt(entityId);
break;
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
int subType = dataStream.readInt();
if(subType == 0)
{
int type = dataStream.readInt();
int id = dataStream.readInt();
if(type == 0)
if(message.guiType == 0)
{
player.openGui(Mekanism.instance, 21, player.worldObj, id, 0, 0);
player.openGui(Mekanism.instance, 21, player.worldObj, message.entityId, 0, 0);
}
else if(type == 1)
else if(message.guiType == 1)
{
player.openGui(Mekanism.instance, 22, player.worldObj, id, 0, 0);
player.openGui(Mekanism.instance, 22, player.worldObj, message.entityId, 0, 0);
}
else if(type == 2)
else if(message.guiType == 2)
{
player.openGui(Mekanism.instance, 23, player.worldObj, id, 0, 0);
player.openGui(Mekanism.instance, 23, player.worldObj, message.entityId, 0, 0);
}
else if(type == 3)
else if(message.guiType == 3)
{
player.openGui(Mekanism.instance, 24, player.worldObj, id, 0, 0);
player.openGui(Mekanism.instance, 24, player.worldObj, message.entityId, 0, 0);
}
else if(type == 4)
else if(message.guiType == 4)
{
player.openGui(Mekanism.instance, 25, player.worldObj, id, 0, 0);
player.openGui(Mekanism.instance, 25, player.worldObj, message.entityId, 0, 0);
}
}
else if(subType == 1)
else if(message.activeType == RobitPacketType.FOLLOW)
{
int id = dataStream.readInt();
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(id);
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId);
if(robit != null)
{
robit.setFollowing(!robit.getFollowing());
}
}
else if(subType == 2)
else if(message.activeType == RobitPacketType.NAME)
{
String name = PacketHandler.readString(dataStream);
int id = dataStream.readInt();
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(id);
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId);
if(robit != null)
{
robit.setName(name);
robit.setName(message.name);
}
}
else if(subType == 3)
else if(message.activeType == RobitPacketType.GO_HOME)
{
int id = dataStream.readInt();
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(id);
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId);
if(robit != null)
{
robit.goHome();
}
}
else if(subType == 4)
else if(message.activeType == RobitPacketType.DROP_PICKUP)
{
int id = dataStream.readInt();
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(id);
EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId);
if(robit != null)
{
robit.setDropPickup(!robit.getDropPickup());
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class RobitMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum RobitPacketType
{
GUI,
FOLLOW,
NAME,
GO_HOME,
DROP_PICKUP;
public RobitPacketType activeType;
public int guiType;
public int entityId;
public String name;
public RobitMessage() {}
public RobitMessage(RobitPacketType type, int i1, int i2, String s)
{
activeType = type;
switch(activeType)
{
case GUI:
guiType = i1;
entityId = i2;
break;
case FOLLOW:
entityId = i1;
break;
case NAME:
name = s;
entityId = i1;
break;
case GO_HOME:
entityId = i1;
break;
case DROP_PICKUP:
entityId = i1;
break;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(activeType.ordinal());
switch(activeType)
{
case GUI:
dataStream.writeInt(guiType);
dataStream.writeInt(entityId);
break;
case FOLLOW:
dataStream.writeInt(entityId);
break;
case NAME:
PacketHandler.writeString(dataStream, name);
dataStream.writeInt(entityId);
break;
case GO_HOME:
dataStream.writeInt(entityId);
break;
case DROP_PICKUP:
dataStream.writeInt(entityId);
break;
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
activeType = RobitPacketType.values()[dataStream.readInt()];
if(activeType == RobitPacketType.GUI)
{
guiType = dataStream.readInt();
entityId = dataStream.readInt();
}
else if(activeType == RobitPacketType.FOLLOW)
{
entityId = dataStream.readInt();
}
else if(activeType == RobitPacketType.NAME)
{
name = PacketHandler.readString(dataStream);
entityId = dataStream.readInt();
}
else if(activeType == RobitPacketType.GO_HOME)
{
entityId = dataStream.readInt();
}
else if(activeType == RobitPacketType.DROP_PICKUP)
{
entityId = dataStream.readInt();
}
}
public static enum RobitPacketType
{
GUI,
FOLLOW,
NAME,
GO_HOME,
DROP_PICKUP;
}
}
}

View file

@ -1,89 +1,40 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemScubaTank;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage;
import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage.ScubaTankPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketScubaTankData extends MekanismPacket
public class PacketScubaTankData implements IMessageHandler<ScubaTankDataMessage, IMessage>
{
public ScubaTankPacket packetType;
public String username;
public boolean value;
public PacketScubaTankData() {}
public PacketScubaTankData(ScubaTankPacket type, String name, boolean state)
{
packetType = type;
if(packetType == ScubaTankPacket.UPDATE)
{
username = name;
value = state;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(ScubaTankDataMessage message, MessageContext context)
{
dataStream.writeInt(packetType.ordinal());
if(packetType == ScubaTankPacket.UPDATE)
EntityPlayer player = PacketHandler.getPlayer(context);
if(message.packetType == ScubaTankPacket.UPDATE)
{
PacketHandler.writeString(dataStream, username);
dataStream.writeBoolean(value);
}
else if(packetType == ScubaTankPacket.FULL)
{
dataStream.writeInt(Mekanism.gasmaskOn.size());
for(String name : Mekanism.gasmaskOn)
if(message.value)
{
PacketHandler.writeString(dataStream, name);
}
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
packetType = ScubaTankPacket.values()[dataStream.readInt()];
if(packetType == ScubaTankPacket.FULL)
{
Mekanism.gasmaskOn.clear();
int amount = dataStream.readInt();
for(int i = 0; i < amount; i++)
{
Mekanism.gasmaskOn.add(PacketHandler.readString(dataStream));
}
}
else if(packetType == ScubaTankPacket.UPDATE)
{
String username = PacketHandler.readString(dataStream);
boolean value = dataStream.readBoolean();
if(value)
{
Mekanism.gasmaskOn.add(username);
Mekanism.gasmaskOn.add(message.username);
}
else {
Mekanism.gasmaskOn.remove(username);
Mekanism.gasmaskOn.remove(message.username);
}
if(!player.worldObj.isRemote)
{
Mekanism.packetPipeline.sendToDimension(new PacketScubaTankData(ScubaTankPacket.UPDATE, username, value), player.worldObj.provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new ScubaTankDataMessage(ScubaTankPacket.UPDATE, message.username, message.value), player.worldObj.provider.dimensionId);
}
}
else if(packetType == ScubaTankPacket.MODE)
else if(message.packetType == ScubaTankPacket.MODE)
{
ItemStack stack = player.getEquipmentInSlot(3);
@ -92,24 +43,79 @@ public class PacketScubaTankData extends MekanismPacket
((ItemScubaTank)stack.getItem()).toggleFlowing(stack);
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class ScubaTankDataMessage implements IMessage
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum ScubaTankPacket
{
UPDATE,
FULL,
MODE;
public ScubaTankPacket packetType;
public String username;
public boolean value;
public ScubaTankDataMessage() {}
public ScubaTankDataMessage(ScubaTankPacket type, String name, boolean state)
{
packetType = type;
if(packetType == ScubaTankPacket.UPDATE)
{
username = name;
value = state;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
if(packetType == ScubaTankPacket.UPDATE)
{
PacketHandler.writeString(dataStream, username);
dataStream.writeBoolean(value);
}
else if(packetType == ScubaTankPacket.FULL)
{
dataStream.writeInt(Mekanism.gasmaskOn.size());
for(String name : Mekanism.gasmaskOn)
{
PacketHandler.writeString(dataStream, name);
}
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = ScubaTankPacket.values()[dataStream.readInt()];
if(packetType == ScubaTankPacket.FULL)
{
Mekanism.gasmaskOn.clear();
int amount = dataStream.readInt();
for(int i = 0; i < amount; i++)
{
Mekanism.gasmaskOn.add(PacketHandler.readString(dataStream));
}
}
else if(packetType == ScubaTankPacket.UPDATE)
{
username = PacketHandler.readString(dataStream);
value = dataStream.readBoolean();
}
}
public static enum ScubaTankPacket
{
UPDATE,
FULL,
MODE;
}
}
}

View file

@ -1,99 +1,102 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
import mekanism.common.tile.TileEntityBasicBlock;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PacketSimpleGui extends MekanismPacket
public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessage>
{
public Coord4D coord4D;
public int guiId;
public PacketSimpleGui() {}
public PacketSimpleGui(Coord4D coord, int gui)
{
coord4D = coord;
guiId = gui;
}
public static void openServerGui(int id, EntityPlayerMP playerMP, World world, Coord4D obj)
{
playerMP.closeContainer();
playerMP.getNextWindowId();
int window = playerMP.currentWindowId;
Mekanism.packetPipeline.sendTo(new PacketSimpleGui(obj, id), playerMP);
playerMP.openContainer = Mekanism.proxy.getServerGui(id, playerMP, world, obj.xCoord, obj.yCoord, obj.zCoord);
playerMP.openContainer.windowId = window;
playerMP.openContainer.addCraftingToCrafters(playerMP);
}
@SideOnly(Side.CLIENT)
public GuiScreen getGui(int id, EntityPlayer player, World world, Coord4D obj)
{
return (GuiScreen)Mekanism.proxy.getClientGui(id, player, world, obj.xCoord, obj.yCoord, obj.zCoord);
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(SimpleGuiMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeInt(guiId);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiId = dataStream.readInt();
EntityPlayer player = PacketHandler.getPlayer(context);
if(!player.worldObj.isRemote)
{
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(coord4D.dimensionId);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
if(worldServer != null && coord4D.getTileEntity(worldServer) instanceof TileEntityBasicBlock)
if(worldServer != null && message.coord4D.getTileEntity(worldServer) instanceof TileEntityBasicBlock)
{
if(guiId == -1)
if(message.guiId == -1)
{
return;
return null;
}
openServerGui(guiId, (EntityPlayerMP)player, player.worldObj, coord4D);
SimpleGuiMessage.openServerGui(message.guiId, (EntityPlayerMP)player, player.worldObj, message.coord4D);
}
}
else {
FMLCommonHandler.instance().showGuiScreen(getGui(guiId, player, player.worldObj, coord4D));
FMLCommonHandler.instance().showGuiScreen(SimpleGuiMessage.getGui(message.guiId, player, player.worldObj, message.coord4D));
}
return null;
}
public static class SimpleGuiMessage implements IMessage
{
public Coord4D coord4D;
public int guiId;
public SimpleGuiMessage() {}
public SimpleGuiMessage(Coord4D coord, int gui)
{
coord4D = coord;
guiId = gui;
}
public static void openServerGui(int id, EntityPlayerMP playerMP, World world, Coord4D obj)
{
playerMP.closeContainer();
playerMP.getNextWindowId();
int window = playerMP.currentWindowId;
Mekanism.packetHandler.sendTo(new SimpleGuiMessage(obj, id), playerMP);
playerMP.openContainer = Mekanism.proxy.getServerGui(id, playerMP, world, obj.xCoord, obj.yCoord, obj.zCoord);
playerMP.openContainer.windowId = window;
playerMP.openContainer.addCraftingToCrafters(playerMP);
}
@SideOnly(Side.CLIENT)
public static GuiScreen getGui(int id, EntityPlayer player, World world, Coord4D obj)
{
return (GuiScreen)Mekanism.proxy.getClientGui(id, player, world, obj.xCoord, obj.yCoord, obj.zCoord);
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeInt(guiId);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiId = dataStream.readInt();
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,49 +1,51 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemPortableTeleporter;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketStatusUpdate.StatusUpdateMessage;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketStatusUpdate extends MekanismPacket
public class PacketStatusUpdate implements IMessageHandler<StatusUpdateMessage, IMessage>
{
public int status;
public PacketStatusUpdate() {}
public PacketStatusUpdate(int state)
{
status = state;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(StatusUpdateMessage message, MessageContext context)
{
dataStream.writeInt(status);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
ItemStack currentStack = player.getCurrentEquippedItem();
ItemStack currentStack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
if(currentStack != null && currentStack.getItem() instanceof ItemPortableTeleporter)
{
ItemPortableTeleporter item = (ItemPortableTeleporter)currentStack.getItem();
item.setStatus(currentStack, dataStream.readInt());
item.setStatus(currentStack, message.status);
}
return null;
}
public static class StatusUpdateMessage implements IMessage
{
public int status;
public StatusUpdateMessage() {}
public StatusUpdateMessage(int state)
{
status = state;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(status);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
status = dataStream.readInt();
}
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
}

View file

@ -1,71 +1,72 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.common.ITileNetwork;
import mekanism.common.PacketHandler;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketTileEntity extends MekanismPacket
public class PacketTileEntity implements IMessageHandler<TileEntityMessage, IMessage>
{
public Coord4D coord4D;
public ArrayList parameters;
public ByteBuf storedBuffer = null;
public PacketTileEntity() {}
public PacketTileEntity(Coord4D coord, ArrayList params)
{
coord4D = coord;
parameters = params;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream) throws Exception
public IMessage onMessage(TileEntityMessage message, MessageContext context)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
PacketHandler.encode(new Object[] {parameters}, dataStream);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream) throws Exception
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
storedBuffer = dataStream.copy();
}
@Override
public void handleClientSide(EntityPlayer player) throws Exception
{
TileEntity tileEntity = coord4D.getTileEntity(player.worldObj);
TileEntity tileEntity = message.coord4D.getTileEntity(PacketHandler.getPlayer(context).worldObj);
if(tileEntity instanceof ITileNetwork)
{
((ITileNetwork)tileEntity).handlePacketData(storedBuffer);
try {
((ITileNetwork)tileEntity).handlePacketData(message.storedBuffer);
} catch(Exception e) {
e.printStackTrace();
}
message.storedBuffer.release();
}
}
@Override
public void handleServerSide(EntityPlayer player) throws Exception
{
TileEntity tileEntity = coord4D.getTileEntity(player.worldObj);
if(tileEntity instanceof ITileNetwork)
return null;
}
public static class TileEntityMessage implements IMessage
{
public Coord4D coord4D;
public ArrayList parameters;
public ByteBuf storedBuffer = null;
public TileEntityMessage() {}
public TileEntityMessage(Coord4D coord, ArrayList params)
{
((ITileNetwork)tileEntity).handlePacketData(storedBuffer);
storedBuffer.release();
coord4D = coord;
parameters = params;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
PacketHandler.encode(new Object[] {parameters}, dataStream);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
storedBuffer = dataStream.copy();
}
}
}

View file

@ -1,7 +1,7 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.api.Coord4D;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasNetwork;
import mekanism.api.gas.GasRegistry;
@ -9,181 +9,193 @@ import mekanism.api.gas.GasStack;
import mekanism.api.transmitters.IGridTransmitter;
import mekanism.common.EnergyNetwork;
import mekanism.common.FluidNetwork;
import mekanism.common.PacketHandler;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage;
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage.PacketType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketTransmitterUpdate extends MekanismPacket
public class PacketTransmitterUpdate implements IMessageHandler<TransmitterUpdateMessage, IMessage>
{
public PacketType packetType;
public TileEntity tileEntity;
public double power;
public GasStack gasStack;
public boolean didGasTransfer;
public FluidStack fluidStack;
public boolean didFluidTransfer;
public PacketTransmitterUpdate() {}
public PacketTransmitterUpdate(PacketType type, TileEntity tile, Object... data)
{
packetType = type;
tileEntity = tile;
switch(packetType)
{
case ENERGY:
power = (Double)data[0];
break;
case GAS:
gasStack = (GasStack)data[0];
didGasTransfer = (Boolean)data[1];
break;
case FLUID:
fluidStack = (FluidStack)data[0];
didFluidTransfer = (Boolean)data[1];
break;
}
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
public IMessage onMessage(TransmitterUpdateMessage message, MessageContext context)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(tileEntity.xCoord);
dataStream.writeInt(tileEntity.yCoord);
dataStream.writeInt(tileEntity.zCoord);
dataStream.writeInt(tileEntity.getWorldObj().provider.dimensionId);
switch(packetType)
{
case ENERGY:
dataStream.writeDouble(power);
break;
case GAS:
dataStream.writeInt(gasStack != null ? gasStack.getGas().getID() : -1);
dataStream.writeInt(gasStack != null ? gasStack.amount : 0);
dataStream.writeBoolean(didGasTransfer);
break;
case FLUID:
dataStream.writeInt(fluidStack != null ? fluidStack.getFluid().getID() : -1);
dataStream.writeInt(fluidStack != null ? fluidStack.amount : 0);
dataStream.writeBoolean(didFluidTransfer);
break;
}
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
packetType = PacketType.values()[dataStream.readInt()];
int x = dataStream.readInt();
int y = dataStream.readInt();
int z = dataStream.readInt();
EntityPlayer player = PacketHandler.getPlayer(context);
if(packetType == PacketType.UPDATE)
if(message.packetType == PacketType.UPDATE)
{
TileEntity tileEntity = player.worldObj.getTileEntity(x, y, z);
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity instanceof IGridTransmitter)
{
((IGridTransmitter)tileEntity).refreshTransmitterNetwork();
}
}
else if(packetType == PacketType.ENERGY)
else if(message.packetType == PacketType.ENERGY)
{
double powerLevel = dataStream.readDouble();
TileEntity tileEntity = player.worldObj.getTileEntity(x, y, z);
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity != null)
{
((IGridTransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork().clientEnergyScale = powerLevel;
((IGridTransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork().clientEnergyScale = message.power;
}
}
else if(packetType == PacketType.GAS)
else if(message.packetType == PacketType.GAS)
{
TileEntity tileEntity = player.worldObj.getTileEntity(x, y, z);
Gas gasType = GasRegistry.getGas(dataStream.readInt());
int amount = dataStream.readInt();
GasStack stack = null;
didGasTransfer = dataStream.readBoolean();
if(gasType != null)
{
stack = new GasStack(gasType, amount);
}
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity != null)
{
GasNetwork net = ((IGridTransmitter<GasNetwork>)tileEntity).getTransmitterNetwork();
if(gasType != null)
if(message.gasType != null)
{
net.refGas = gasType;
net.refGas = message.gasType;
}
net.gasStored = stack;
net.didTransfer = didGasTransfer;
net.gasStored = message.gasStack;
net.didTransfer = message.didGasTransfer;
}
}
else if(packetType == PacketType.FLUID)
else if(message.packetType == PacketType.FLUID)
{
TileEntity tileEntity = player.worldObj.getTileEntity(x, y, z);
int type = dataStream.readInt();
Fluid fluidType = type != -1 ? FluidRegistry.getFluid(type) : null;
int amount = dataStream.readInt();
FluidStack stack = null;
didFluidTransfer = dataStream.readBoolean();
if(fluidType != null)
{
stack = new FluidStack(fluidType, amount);
}
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity != null)
{
FluidNetwork net = ((IGridTransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork();
if(fluidType != null)
if(message.fluidType != null)
{
net.refFluid = fluidType;
net.refFluid = message.fluidType;
}
net.fluidStored = stack;
net.didTransfer = didFluidTransfer;
net.fluidStored = message.fluidStack;
net.didTransfer = message.didFluidTransfer;
net.fluidScale = net.getScale();
}
}
return null;
}
@Override
public void handleClientSide(EntityPlayer player)
public static class TransmitterUpdateMessage implements IMessage
{
public PacketType packetType;
public Coord4D coord4D;
public double power;
public GasStack gasStack;
public Gas gasType;
public boolean didGasTransfer;
public FluidStack fluidStack;
public Fluid fluidType;
public boolean didFluidTransfer;
public int amount;
public TransmitterUpdateMessage() {}
public TransmitterUpdateMessage(PacketType type, Coord4D coord, Object... data)
{
packetType = type;
coord4D = coord;
switch(packetType)
{
case ENERGY:
power = (Double)data[0];
break;
case GAS:
gasStack = (GasStack)data[0];
didGasTransfer = (Boolean)data[1];
break;
case FLUID:
fluidStack = (FluidStack)data[0];
didFluidTransfer = (Boolean)data[1];
break;
}
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(packetType.ordinal());
dataStream.writeInt(coord4D.xCoord);
dataStream.writeInt(coord4D.yCoord);
dataStream.writeInt(coord4D.zCoord);
dataStream.writeInt(coord4D.dimensionId);
switch(packetType)
{
case ENERGY:
dataStream.writeDouble(power);
break;
case GAS:
dataStream.writeInt(gasStack != null ? gasStack.getGas().getID() : -1);
dataStream.writeInt(gasStack != null ? gasStack.amount : 0);
dataStream.writeBoolean(didGasTransfer);
break;
case FLUID:
dataStream.writeInt(fluidStack != null ? fluidStack.getFluid().getID() : -1);
dataStream.writeInt(fluidStack != null ? fluidStack.amount : 0);
dataStream.writeBoolean(didFluidTransfer);
break;
}
}
@Override
public void fromBytes(ByteBuf dataStream)
{
packetType = PacketType.values()[dataStream.readInt()];
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
public static enum PacketType
{
UPDATE,
ENERGY,
GAS,
FLUID
if(packetType == PacketType.ENERGY)
{
power = dataStream.readDouble();
}
else if(packetType == PacketType.GAS)
{
gasType = GasRegistry.getGas(dataStream.readInt());
amount = dataStream.readInt();
didGasTransfer = dataStream.readBoolean();
if(gasType != null)
{
gasStack = new GasStack(gasType, amount);
}
}
else if(packetType == PacketType.FLUID)
{
int type = dataStream.readInt();
fluidType = type != -1 ? FluidRegistry.getFluid(type) : null;
amount = dataStream.readInt();
didFluidTransfer = dataStream.readBoolean();
if(fluidType != null)
{
fluidStack = new FluidStack(fluidType, amount);
}
}
}
public static enum PacketType
{
UPDATE,
ENERGY,
GAS,
FLUID
}
}
}

View file

@ -1,48 +1,50 @@
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemWalkieTalkie;
import net.minecraft.entity.player.EntityPlayer;
import mekanism.common.network.PacketWalkieTalkieState.WalkieTalkieStateMessage;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class PacketWalkieTalkieState extends MekanismPacket
public class PacketWalkieTalkieState implements IMessageHandler<WalkieTalkieStateMessage, IMessage>
{
public int channel;
public PacketWalkieTalkieState() {}
public PacketWalkieTalkieState(int chan)
{
channel = chan;
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
{
dataStream.writeInt(channel);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
{
channel = dataStream.readInt();
}
@Override
public void handleClientSide(EntityPlayer player)
public IMessage onMessage(WalkieTalkieStateMessage message, MessageContext context)
{
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
}
@Override
public void handleServerSide(EntityPlayer player)
{
ItemStack itemstack = player.getCurrentEquippedItem();
if(itemstack != null && itemstack.getItem() instanceof ItemWalkieTalkie)
{
((ItemWalkieTalkie)itemstack.getItem()).setChannel(itemstack, channel);
((ItemWalkieTalkie)itemstack.getItem()).setChannel(itemstack, message.channel);
}
return null;
}
public static class WalkieTalkieStateMessage implements IMessage
{
public int channel;
public WalkieTalkieStateMessage() {}
public WalkieTalkieStateMessage(int chan)
{
channel = chan;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(channel);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
channel = dataStream.readInt();
}
}
}

View file

@ -12,8 +12,8 @@ import mekanism.api.Coord4D;
import mekanism.common.ITileComponent;
import mekanism.common.ITileNetwork;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@ -61,7 +61,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
{
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
}
}
@ -119,7 +119,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
if(worldObj.isRemote)
{
Mekanism.packetPipeline.sendToServer(new PacketDataRequest(Coord4D.get(this)));
Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(this)));
}
}
@ -178,7 +178,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
if(facing != clientFacing)
{
Mekanism.packetPipeline.sendToDimension(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), worldObj.provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), worldObj.provider.dimensionId);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
clientFacing = facing;
}
@ -226,7 +226,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
if(redstone != power)
{
redstone = power;
Mekanism.packetPipeline.sendToDimension(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), worldObj.provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), worldObj.provider.dimensionId);
}
}
}

View file

@ -15,7 +15,7 @@ import mekanism.common.IRedstoneControl;
import mekanism.common.IUpgradeTile;
import mekanism.common.Mekanism;
import mekanism.common.SideData;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.MekanismUtils;
@ -115,7 +115,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
}
@ -240,7 +240,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -10,7 +10,7 @@ import mekanism.common.IConfigurable;
import mekanism.common.ILogisticalTransporter;
import mekanism.common.Mekanism;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.transporter.TransporterManager;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
@ -380,7 +380,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
if(!worldObj.isRemote)
{
MekanismUtils.saveChunk(this);
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
prevCount = getItemCount();
sortStacks();
}
@ -492,7 +492,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
if(clientActive != active)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
clientActive = active;
}

View file

@ -7,8 +7,8 @@ import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.common.ITileNetwork;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketDataRequest;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -29,7 +29,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
mainY = y;
mainZ = z;
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -40,7 +40,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
if(worldObj.isRemote)
{
Mekanism.packetPipeline.sendToServer(new PacketDataRequest(Coord4D.get(this)));
Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(this)));
}
}
@ -71,7 +71,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork
}
prevPower = power;
Mekanism.packetPipeline.sendToDimension(new PacketTileEntity(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), tileEntity.getWorldObj().provider.dimensionId);
Mekanism.packetHandler.sendToDimension(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), tileEntity.getWorldObj().provider.dimensionId);
}
}
}

View file

@ -17,7 +17,7 @@ import mekanism.common.IActiveState;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.entity.EntityRobit;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -170,7 +170,7 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
if(prevActive != active)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
prevActive = active;

View file

@ -22,7 +22,7 @@ import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.util.ChargeUtils;
@ -114,7 +114,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -216,7 +216,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
return;
@ -336,7 +336,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -18,7 +18,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.ChargeUtils;
@ -89,7 +89,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -344,7 +344,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -18,7 +18,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
@ -86,7 +86,7 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -182,7 +182,7 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
return;
@ -334,7 +334,7 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -17,7 +17,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.ChargeUtils;
@ -85,7 +85,7 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -299,7 +299,7 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -18,7 +18,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
@ -97,7 +97,7 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -234,7 +234,7 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
return;
@ -382,7 +382,7 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -25,7 +25,7 @@ import mekanism.common.miner.MOreDictFilter;
import mekanism.common.miner.MinerFilter;
import mekanism.common.miner.ThreadMinerSearch;
import mekanism.common.miner.ThreadMinerSearch.State;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.transporter.InvStack;
import mekanism.common.transporter.TransporterManager;
@ -260,7 +260,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
{
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getSmallPacket(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getSmallPacket(new ArrayList())), (EntityPlayerMP)player);
}
}
@ -511,7 +511,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
{
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
}
}
@ -655,7 +655,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
}
return;
@ -966,7 +966,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
if(clientActive != active)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
clientActive = active;
}
@ -1277,7 +1277,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
}
return null;

View file

@ -8,7 +8,7 @@ import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tank.SynchronizedTankData;
import mekanism.common.tank.SynchronizedTankData.ValveData;
import mekanism.common.tank.TankUpdateProtocol;
@ -173,7 +173,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
}
}
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
prevStructure = structure != null;
@ -235,7 +235,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
structure.fluidStored = null;
}
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
}
@ -295,7 +295,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
}
}
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
}
@ -430,7 +430,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
if(tileEntity != null && tileEntity.isRendering)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())));
}
}
}

View file

@ -15,7 +15,7 @@ import mekanism.api.EnumColor;
import mekanism.common.IConfigurable;
import mekanism.common.ISustainedTank;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
@ -106,7 +106,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(suck(true))
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
}
clean(true);

View file

@ -17,7 +17,7 @@ import mekanism.api.gas.ITubeConnection;
import mekanism.common.ISustainedTank;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.ChargeUtils;
@ -150,7 +150,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
if(worldObj.rand.nextInt(3) == 2)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getParticlePacket(0, new ArrayList())), Coord4D.get(this).getTargetPoint(40D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getParticlePacket(0, new ArrayList())), Coord4D.get(this).getTargetPoint(40D));
}
}
}
@ -176,7 +176,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
if(worldObj.rand.nextInt(3) == 2)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getParticlePacket(1, new ArrayList())), Coord4D.get(this).getTargetPoint(40D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getParticlePacket(1, new ArrayList())), Coord4D.get(this).getTargetPoint(40D));
}
}
}

View file

@ -10,7 +10,7 @@ import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.CableUtils;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
@ -65,7 +65,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
if(newScale != prevScale)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
}
prevScale = newScale;

View file

@ -26,7 +26,7 @@ import mekanism.common.Mekanism;
import mekanism.common.SideData;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.ChargeUtils;
@ -152,7 +152,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -770,7 +770,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -15,7 +15,7 @@ import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -160,7 +160,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
return;

View file

@ -14,7 +14,7 @@ import mekanism.common.ILogisticalTransporter;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.transporter.Finder.FirstFinder;
import mekanism.common.transporter.InvStack;
import mekanism.common.transporter.TItemStackFilter;
@ -148,7 +148,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
}
}
}
@ -493,7 +493,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{
if(!worldObj.isRemote)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getFilterPacket(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getFilterPacket(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
}
}
@ -516,7 +516,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
if(clientActive != active)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
if(active)
{

View file

@ -21,7 +21,7 @@ import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.tile.component.TileComponentEjector;
@ -123,7 +123,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -509,7 +509,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -17,7 +17,7 @@ import mekanism.common.IRedstoneControl;
import mekanism.common.ISustainedTank;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
@ -92,7 +92,7 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -288,7 +288,7 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp
for(EntityPlayer player : playersUsing)
{
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
}
return;
@ -408,7 +408,7 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

View file

@ -10,7 +10,7 @@ import mekanism.api.Coord4D;
import mekanism.api.ISalinationSolar;
import mekanism.common.IConfigurable;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tank.TankUpdateProtocol;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
@ -114,7 +114,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
{
if(Math.abs((float)waterTank.getFluidAmount()/waterTank.getCapacity()-prevScale) > 0.01)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
prevScale = (float)waterTank.getFluidAmount()/waterTank.getCapacity();
}
}
@ -150,7 +150,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
if(structured != prev)
{
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
}
if(structured)

View file

@ -9,7 +9,7 @@ import mekanism.common.IActiveState;
import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
@ -57,7 +57,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement
if(updateDelay == 0 && clientActive != isActive)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
@ -142,7 +142,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement
if(clientActive != active && updateDelay == 0)
{
Mekanism.packetPipeline.sendToAll(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())));
Mekanism.packetHandler.sendToAll(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;

Some files were not shown because too many files have changed in this diff Show more