2012-12-17 21:21:53 +01:00
|
|
|
package com.pahimar.ee3.network.packet;
|
2012-12-05 22:06:50 +01:00
|
|
|
|
2012-12-06 05:15:36 +01:00
|
|
|
import java.io.DataInputStream;
|
|
|
|
import java.io.DataOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2012-12-13 16:01:41 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.network.INetworkManager;
|
2012-12-19 19:09:56 +01:00
|
|
|
|
2013-01-04 03:17:49 +01:00
|
|
|
import com.pahimar.ee3.EquivalentExchange3;
|
2012-12-19 19:09:56 +01:00
|
|
|
import com.pahimar.ee3.core.handlers.WorldTransmutationHandler;
|
|
|
|
import com.pahimar.ee3.network.PacketTypeHandler;
|
|
|
|
|
2013-01-04 03:17:49 +01:00
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2012-12-06 05:15:36 +01:00
|
|
|
import cpw.mods.fml.common.network.Player;
|
|
|
|
|
2012-12-17 22:38:56 +01:00
|
|
|
public class PacketRequestEvent extends PacketEE {
|
2012-12-05 22:06:50 +01:00
|
|
|
|
2012-12-06 22:04:20 +01:00
|
|
|
public byte eventType;
|
2012-12-05 22:06:50 +01:00
|
|
|
public int originX, originY, originZ;
|
2012-12-06 22:04:20 +01:00
|
|
|
public byte sideHit;
|
2012-12-06 05:15:36 +01:00
|
|
|
public byte rangeX, rangeY, rangeZ;
|
2012-12-07 03:06:16 +01:00
|
|
|
public String data;
|
2012-12-05 22:06:50 +01:00
|
|
|
|
2012-12-17 22:38:56 +01:00
|
|
|
public PacketRequestEvent() {
|
2012-12-06 22:04:20 +01:00
|
|
|
|
2012-12-17 22:38:56 +01:00
|
|
|
super(PacketTypeHandler.REQUEST_EVENT, false);
|
2012-12-06 05:15:36 +01:00
|
|
|
}
|
2012-12-06 22:04:20 +01:00
|
|
|
|
2012-12-17 22:38:56 +01:00
|
|
|
public PacketRequestEvent(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {
|
2012-12-06 22:04:20 +01:00
|
|
|
|
2012-12-17 22:38:56 +01:00
|
|
|
super(PacketTypeHandler.REQUEST_EVENT, false);
|
2012-12-06 22:04:20 +01:00
|
|
|
this.eventType = eventType;
|
|
|
|
this.originX = originX;
|
|
|
|
this.originY = originY;
|
|
|
|
this.originZ = originZ;
|
|
|
|
this.sideHit = sideHit;
|
|
|
|
this.rangeX = rangeX;
|
|
|
|
this.rangeY = rangeY;
|
|
|
|
this.rangeZ = rangeZ;
|
2012-12-07 03:06:16 +01:00
|
|
|
this.data = data;
|
2012-12-06 22:04:20 +01:00
|
|
|
}
|
|
|
|
|
2012-12-06 05:15:36 +01:00
|
|
|
public void writeData(DataOutputStream data) throws IOException {
|
2012-12-06 22:04:20 +01:00
|
|
|
|
|
|
|
data.writeByte(eventType);
|
2012-12-06 05:15:36 +01:00
|
|
|
data.writeInt(originX);
|
|
|
|
data.writeInt(originY);
|
|
|
|
data.writeInt(originZ);
|
2012-12-06 22:04:20 +01:00
|
|
|
data.writeByte(sideHit);
|
2012-12-06 05:15:36 +01:00
|
|
|
data.writeByte(rangeX);
|
|
|
|
data.writeByte(rangeY);
|
|
|
|
data.writeByte(rangeZ);
|
2012-12-07 03:06:16 +01:00
|
|
|
data.writeUTF(this.data);
|
2012-12-06 05:15:36 +01:00
|
|
|
}
|
2012-12-06 22:04:20 +01:00
|
|
|
|
2012-12-06 05:15:36 +01:00
|
|
|
public void readData(DataInputStream data) throws IOException {
|
2012-12-06 22:04:20 +01:00
|
|
|
|
|
|
|
this.eventType = data.readByte();
|
2012-12-06 05:15:36 +01:00
|
|
|
this.originX = data.readInt();
|
|
|
|
this.originY = data.readInt();
|
|
|
|
this.originZ = data.readInt();
|
2012-12-06 22:04:20 +01:00
|
|
|
this.sideHit = data.readByte();
|
2012-12-06 05:15:36 +01:00
|
|
|
this.rangeX = data.readByte();
|
|
|
|
this.rangeY = data.readByte();
|
|
|
|
this.rangeZ = data.readByte();
|
2012-12-07 03:06:16 +01:00
|
|
|
this.data = data.readUTF();
|
2012-12-06 05:15:36 +01:00
|
|
|
}
|
2012-12-06 22:04:20 +01:00
|
|
|
|
2012-12-06 05:15:36 +01:00
|
|
|
public void execute(INetworkManager manager, Player player) {
|
2013-01-04 03:17:49 +01:00
|
|
|
|
2012-12-13 04:41:40 +01:00
|
|
|
EntityPlayer thePlayer = (EntityPlayer) player;
|
2012-12-19 19:09:56 +01:00
|
|
|
WorldTransmutationHandler.handleWorldTransmutation(thePlayer, originX, originY, originZ, rangeX, rangeY, rangeZ, sideHit, data);
|
2012-12-05 22:06:50 +01:00
|
|
|
}
|
|
|
|
}
|