From dbbe82936a24ea64cd9cd6971fcb3e4117202a1b Mon Sep 17 00:00:00 2001 From: Astoria Date: Thu, 6 Apr 2023 17:49:45 -0500 Subject: [PATCH] Multiplayer lives! Somewhat! --- .../net/brokenmoon/afloydwiremod/WireMod.java | 6 +- .../api/AbstractWireTileEntity.java | 1 + .../afloydwiremod/gui/GuiWiring.java | 46 ++++--- .../mixin/MixinNetClientHandler.java | 15 ++- .../mixin/MixinNetServerHandler.java | 42 +++++- .../mixinInterfaces/INetHandler.java | 9 +- .../packet/WiremodPacketSyncIO.java | 10 +- .../packet/WiremodWiringGuiPacket.java | 4 +- .../packet/WiremodWiringPacket.java | 121 ++++++++++++++++++ 9 files changed, 211 insertions(+), 43 deletions(-) create mode 100644 src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringPacket.java diff --git a/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java b/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java index 9198280..a46e60e 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java @@ -3,10 +3,7 @@ package net.brokenmoon.afloydwiremod; import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; import net.brokenmoon.afloydwiremod.item.ToolWiring; import net.brokenmoon.afloydwiremod.mixin.AccessorPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodPacketSyncIO; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerGuiPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodWiringGuiPacket; +import net.brokenmoon.afloydwiremod.packet.*; import net.brokenmoon.afloydwiremod.ter.TERDisplay; import net.brokenmoon.afloydwiremod.ter.TERWire; import net.brokenmoon.afloydwiremod.tile.ChipTile; @@ -31,6 +28,7 @@ public class WireMod implements ModInitializer { AccessorPacket.callAddIdClassMapping(110, true, true, WiremodProgrammerPacket.class); AccessorPacket.callAddIdClassMapping(111, true, true, WiremodWiringGuiPacket.class); AccessorPacket.callAddIdClassMapping(112, true, true, WiremodPacketSyncIO.class); + AccessorPacket.callAddIdClassMapping(113, true, true, WiremodWiringPacket.class); } public static final String MOD_ID = "afloydwiremod"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java index 72e70f1..1a04aae 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java @@ -96,6 +96,7 @@ public abstract class AbstractWireTileEntity extends TileEntity { } } } + worldObj.markBlocksDirty(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); } public void prepForDelete() { diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java index 73b55cc..291b077 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java @@ -3,9 +3,13 @@ package net.brokenmoon.afloydwiremod.gui; import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; import net.brokenmoon.afloydwiremod.api.WireConnection; import net.brokenmoon.afloydwiremod.item.ToolWiring; +import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket; +import net.brokenmoon.afloydwiremod.packet.WiremodWiringPacket; import net.minecraft.client.Minecraft; +import net.minecraft.src.EntityClientPlayerMP; import net.minecraft.src.EntityPlayer; import net.minecraft.src.GuiButton; +import net.minecraft.src.NetClientHandler; import java.util.ArrayList; @@ -37,12 +41,14 @@ public class GuiWiring extends GuiScrollable { public GuiWiring(EntityPlayer player, ToolWiring tool, AbstractWireTileEntity wireEntity, int x, int y, int z) { super.initGui(); + this.player = player; this.tool = tool; this.x = x; this.y = y; this.z = z; this.wireEntity = wireEntity; otherEntity = (AbstractWireTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(tool.x, tool.y, tool.z); + System.out.println(player instanceof EntityClientPlayerMP); } @Override @@ -74,26 +80,36 @@ public class GuiWiring extends GuiScrollable { } } else if(!this.tool.type.equals("unpaired")) { if(this.tool.type.equals("input") && wireEntity.outputs[guibutton.slot].wire.isMade != true && otherEntity.inputs[tool.slot].wire.isMade != true) { - wireEntity.outputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width); - otherEntity.inputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot); - wireEntity.update(); - wireEntity.updateIO(); - otherEntity.update(); - otherEntity.updateIO(); - tool.xadd = new ArrayList(); - tool.yadd = new ArrayList(); - tool.zadd = new ArrayList(); - tool.sideadd = new ArrayList(); - tool.type = "unpaired"; - } else if(this.tool.type.equals("output") && otherEntity.outputs[tool.slot].wire.isMade != true && wireEntity.inputs[guibutton.slot].wire.isMade != true ) { - if(otherEntity != null) { - otherEntity.outputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width); - wireEntity.inputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot); + if(this.player instanceof EntityClientPlayerMP){ + NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue; + netclienthandler.addToSendQueue(new WiremodWiringPacket(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord, this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width)); + netclienthandler.addToSendQueue(new WiremodWiringPacket(this.tool.x, this.tool.y, this.tool.z, this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot)); + System.out.println("Okay"); + } else{ + wireEntity.outputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width); + otherEntity.inputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot); wireEntity.update(); wireEntity.updateIO(); otherEntity.update(); otherEntity.updateIO(); } + } else if(this.tool.type.equals("output") && otherEntity.outputs[tool.slot].wire.isMade != true && wireEntity.inputs[guibutton.slot].wire.isMade != true ) { + if(otherEntity != null) { + if(this.player instanceof EntityClientPlayerMP){ + NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue; + netclienthandler.addToSendQueue(new WiremodWiringPacket(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord, this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width)); + netclienthandler.addToSendQueue(new WiremodWiringPacket(this.tool.x, this.tool.y, this.tool.z, this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot)); + System.out.println("Okay"); + } else{ + otherEntity.outputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width); + wireEntity.inputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot); + wireEntity.update(); + wireEntity.updateIO(); + otherEntity.update(); + otherEntity.updateIO(); + } + + } tool.xadd = new ArrayList(); tool.yadd = new ArrayList(); tool.zadd = new ArrayList(); diff --git a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetClientHandler.java b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetClientHandler.java index 1427e33..b840423 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetClientHandler.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetClientHandler.java @@ -5,10 +5,7 @@ import net.brokenmoon.afloydwiremod.gui.GuiWiring; import net.brokenmoon.afloydwiremod.item.ToolWiring; import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer; import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler; -import net.brokenmoon.afloydwiremod.packet.WiremodPacketSyncIO; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerGuiPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodWiringGuiPacket; +import net.brokenmoon.afloydwiremod.packet.*; import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; import net.minecraft.client.Minecraft; import net.minecraft.src.NetClientHandler; @@ -32,12 +29,11 @@ public class MixinNetClientHandler implements INetHandler { @Override public void wiremodHandleOpenWiringGUI(WiremodWiringGuiPacket packet) { - System.out.println(packet.x + " " + packet.y + " " + packet.z); - this.mc.displayGuiScreen(new GuiWiring(this.mc.thePlayer, ((ToolWiring)this.mc.thePlayer.inventory.getCurrentItem().getItem()), (AbstractWireTileEntity) this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z), packet.x2, packet.y2, packet.z2)); + ((IEntityPlayer)this.mc.thePlayer).displayGuiWiring(((ToolWiring)this.mc.thePlayer.inventory.getCurrentItem().getItem()), (AbstractWireTileEntity) this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z), packet.x2, packet.y2, packet.z2); } @Override - public void handleIODisc(WiremodPacketSyncIO packet) { + public void wiremodHandleIODisc(WiremodPacketSyncIO packet) { boolean test = this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z) instanceof ChipTileEntity; System.out.println("Sync Try! " + " " + packet.x + " " + packet.y + " " + packet.z + " " + test); TileEntity tileentity; @@ -49,4 +45,9 @@ public class MixinNetClientHandler implements INetHandler { wireEntity.onInventoryChanged(); } } + + @Override + public void wiremodHandleWireChips(WiremodWiringPacket wiremodWiringPacket) { + + } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java index b28e9f3..bc20985 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java @@ -1,10 +1,9 @@ package net.brokenmoon.afloydwiremod.mixin; +import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; +import net.brokenmoon.afloydwiremod.api.WireConnection; import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler; -import net.brokenmoon.afloydwiremod.packet.WiremodPacketSyncIO; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerGuiPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodWiringGuiPacket; +import net.brokenmoon.afloydwiremod.packet.*; import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; import net.minecraft.server.MinecraftServer; import net.minecraft.src.EntityPlayerMP; @@ -12,6 +11,8 @@ import net.minecraft.src.NetServerHandler; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import java.util.ArrayList; + @Mixin(value = NetServerHandler.class, remap = false) public class MixinNetServerHandler implements INetHandler { @Shadow @@ -35,7 +36,38 @@ public class MixinNetServerHandler implements INetHandler { } @Override - public void handleIODisc(WiremodPacketSyncIO wiremodPacketSyncIO) { + public void wiremodHandleIODisc(WiremodPacketSyncIO wiremodPacketSyncIO) { + + } + @Override + public void wiremodHandleWireChips(WiremodWiringPacket packet) { + switch(packet.type){ + case 0: + AbstractWireTileEntity wireEntity; + if(!packet.backwired) { + wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x1, packet.y1, packet.z1); + wireEntity.outputs[packet.slot1].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot1, packet.slot2, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width); + } else{ + wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x2, packet.y2, packet.z2); + wireEntity.outputs[packet.slot1].wire = new WireConnection(packet.x1, packet.y1, packet.z1, packet.slot1, packet.slot2, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width); + } + wireEntity.update(); + wireEntity.updateIO(); + break; + case 1: + AbstractWireTileEntity otherEntity; + if(!packet.backwired) { + otherEntity = (AbstractWireTileEntity)this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x1, packet.y1, packet.z1); + otherEntity.inputs[packet.slot2].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot1, packet.slot2); + } else{ + otherEntity = (AbstractWireTileEntity)this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x2, packet.y2, packet.z2); + otherEntity.inputs[packet.slot2].wire = new WireConnection(packet.x1, packet.y1, packet.z1, packet.slot1, packet.slot2); + } + otherEntity.update(); + otherEntity.updateIO(); + break; + } + System.out.println("9"); } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/mixinInterfaces/INetHandler.java b/src/main/java/net/brokenmoon/afloydwiremod/mixinInterfaces/INetHandler.java index 378a39d..395bb04 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/mixinInterfaces/INetHandler.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/mixinInterfaces/INetHandler.java @@ -1,9 +1,6 @@ package net.brokenmoon.afloydwiremod.mixinInterfaces; -import net.brokenmoon.afloydwiremod.packet.WiremodPacketSyncIO; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerGuiPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket; -import net.brokenmoon.afloydwiremod.packet.WiremodWiringGuiPacket; +import net.brokenmoon.afloydwiremod.packet.*; public interface INetHandler { void wiremodHandleOpenProgrammerGUI(WiremodProgrammerGuiPacket packet); @@ -12,5 +9,7 @@ public interface INetHandler { void wiremodHandleOpenWiringGUI(WiremodWiringGuiPacket wiremodWiringGuiPacket); - void handleIODisc(WiremodPacketSyncIO wiremodPacketSyncIO); + void wiremodHandleIODisc(WiremodPacketSyncIO wiremodPacketSyncIO); + + void wiremodHandleWireChips(WiremodWiringPacket wiremodWiringPacket); } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodPacketSyncIO.java b/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodPacketSyncIO.java index 83d9d8a..09a3096 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodPacketSyncIO.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodPacketSyncIO.java @@ -61,7 +61,7 @@ public class WiremodPacketSyncIO extends Packet { this.io[i].wire.isMade = dataInputStream.readBoolean(); if(dataInputStream.readBoolean()){ int ixlength = dataInputStream.readInt(); - for(int ix = 0; i < ixlength; i++){ + for(int ix = 0; ix < ixlength; ix++){ this.io[i].wire.xadd.add(dataInputStream.readInt()); this.io[i].wire.yadd.add(dataInputStream.readInt()); this.io[i].wire.zadd.add(dataInputStream.readInt()); @@ -97,7 +97,7 @@ public class WiremodPacketSyncIO extends Packet { this.oi[i].wire.isMade = dataInputStream.readBoolean(); if(dataInputStream.readBoolean()){ int ixlength = dataInputStream.readInt(); - for(int ix = 0; i < ixlength; i++){ + for(int ix = 0; ix < ixlength; ix++){ this.oi[i].wire.xadd.add(dataInputStream.readInt()); this.oi[i].wire.yadd.add(dataInputStream.readInt()); this.oi[i].wire.zadd.add(dataInputStream.readInt()); @@ -165,7 +165,7 @@ public class WiremodPacketSyncIO extends Packet { size++; dataOutputStream.writeInt(this.io[i].wire.xadd.size()); size = size + 4; - for(int ix = 0; i < this.io[i].wire.xadd.size(); i++){ + for(int ix = 0; ix < this.io[i].wire.xadd.size(); ix++){ dataOutputStream.writeInt(this.io[i].wire.xadd.get(ix)); dataOutputStream.writeInt(this.io[i].wire.yadd.get(ix)); dataOutputStream.writeInt(this.io[i].wire.zadd.get(ix)); @@ -236,7 +236,7 @@ public class WiremodPacketSyncIO extends Packet { size++; dataOutputStream.writeInt(this.oi[i].wire.xadd.size()); size = size + 4; - for(int ix = 0; i < this.oi[i].wire.xadd.size(); i++){ + for(int ix = 0; ix < this.oi[i].wire.xadd.size(); ix++){ dataOutputStream.writeInt(this.oi[i].wire.xadd.get(ix)); dataOutputStream.writeInt(this.oi[i].wire.yadd.get(ix)); dataOutputStream.writeInt(this.oi[i].wire.zadd.get(ix)); @@ -263,7 +263,7 @@ public class WiremodPacketSyncIO extends Packet { @Override public void processPacket(NetHandler netHandler) { - ((INetHandler)netHandler).handleIODisc(this); + ((INetHandler)netHandler).wiremodHandleIODisc(this); } @Override diff --git a/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringGuiPacket.java b/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringGuiPacket.java index c631daa..feceabe 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringGuiPacket.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringGuiPacket.java @@ -23,8 +23,8 @@ public class WiremodWiringGuiPacket extends Packet { this.y = y; this.z = z; this.x2 = x2; - this.y2 = z2; - this.z2 = y2; + this.y2 = y2; + this.z2 = z2; } @Override public void readPacketData(DataInputStream dataInputStream) throws IOException { diff --git a/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringPacket.java b/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringPacket.java new file mode 100644 index 0000000..75cb628 --- /dev/null +++ b/src/main/java/net/brokenmoon/afloydwiremod/packet/WiremodWiringPacket.java @@ -0,0 +1,121 @@ +package net.brokenmoon.afloydwiremod.packet; + +import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler; +import net.minecraft.src.NetHandler; +import net.minecraft.src.Packet; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; + +public class WiremodWiringPacket extends Packet { + public int type; + public int x1; + public int y1; + public int z1; + public int x2; + public int y2; + public int z2; + public int slot1; + public int slot2; + public ArrayList xadd; + public ArrayList yadd; + public ArrayList zadd; + public ArrayList sideadd; + public boolean backwired; + public float red = 1.0f; + public float green = 0f; + public float blue = 0f; + public float alpha = 1f; + public float width = 0.5f; + private int size = 0; + public WiremodWiringPacket(){ + System.out.println("Z"); + } + public WiremodWiringPacket(int x1, int y1, int z1, int x2, int y2, int z2, int slot1, int slot2, ArrayList xadd, ArrayList yadd, ArrayList zadd, ArrayList sideadd, boolean b, float red, float green, float blue, float alpha, float width) { + this.type = 0; + this.x1 = x1; + this.y1 = y1; + this.z1 = z1; + this.x2 = x2; + this.y2 = y2; + this.z2 = z2; + this.slot1 = slot1; + this.slot2 = slot2; + this.xadd = xadd; + this.yadd = yadd; + this.zadd = zadd; + this.sideadd = sideadd; + this.backwired = b; + this.red = red; + this.blue = blue; + this.green = green; + this.alpha = alpha; + this.width = width; + System.out.println("X"); + } + + public WiremodWiringPacket(int x1, int y1, int z1, int x2, int y2, int z2, int slot1, int slot2) { + this.type = 1; + this.x1 = x1; + this.y1 = y1; + this.z1 = z1; + this.x2 = x2; + this.y2 = y2; + this.z2 = z2; + this.slot1 = slot1; + this.slot2 = slot2; + } + + @Override + public void readPacketData(DataInputStream dataInputStream) throws IOException { + this.type = dataInputStream.readInt(); + this.x1 = dataInputStream.readInt(); + this.y1 = dataInputStream.readInt(); + this.z1 = dataInputStream.readInt(); + this.x2 = dataInputStream.readInt(); + this.y2 = dataInputStream.readInt(); + this.z2 = dataInputStream.readInt(); + this.slot1 = dataInputStream.readInt(); + this.slot2 = dataInputStream.readInt(); + backwired = dataInputStream.readBoolean(); + red = dataInputStream.readFloat(); + green = dataInputStream.readFloat(); + blue = dataInputStream.readFloat(); + alpha = dataInputStream.readFloat(); + width = dataInputStream.readFloat(); + boolean isxadd = dataInputStream.readBoolean(); + System.out.println("C"); + } + + @Override + public void writePacketData(DataOutputStream dataOutputStream) throws IOException { + dataOutputStream.writeInt(type); + dataOutputStream.writeInt(x1); + dataOutputStream.writeInt(y1); + dataOutputStream.writeInt(z1); + dataOutputStream.writeInt(x2); + dataOutputStream.writeInt(y2); + dataOutputStream.writeInt(z2); + dataOutputStream.writeInt(slot1); + dataOutputStream.writeInt(slot2); + dataOutputStream.writeBoolean(backwired); + dataOutputStream.writeFloat(red); + dataOutputStream.writeFloat(green); + dataOutputStream.writeFloat(blue); + dataOutputStream.writeFloat(alpha); + dataOutputStream.writeFloat(width); + dataOutputStream.writeBoolean(xadd != null); + } + + @Override + public void processPacket(NetHandler netHandler) { + ((INetHandler)netHandler).wiremodHandleWireChips(this); + } + + @Override + public int getPacketSize() { + return 14 * 4 + 2; + } +}