Multiplayer lives! Somewhat!
parent
09c57a3d35
commit
dbbe82936a
@ -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<Integer> xadd;
|
||||||
|
public ArrayList<Integer> yadd;
|
||||||
|
public ArrayList<Integer> zadd;
|
||||||
|
public ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue