2012-12-17 21:21:53 +01:00
|
|
|
package com.pahimar.ee3.network.packet;
|
2012-09-21 22:13:21 +02:00
|
|
|
|
|
|
|
import java.io.DataInputStream;
|
|
|
|
import java.io.DataOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2012-12-19 19:09:56 +01:00
|
|
|
import net.minecraft.network.INetworkManager;
|
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
|
|
|
|
2012-12-17 21:21:53 +01:00
|
|
|
import com.pahimar.ee3.network.PacketTypeHandler;
|
|
|
|
|
2012-09-21 22:13:21 +02:00
|
|
|
import cpw.mods.fml.common.network.Player;
|
|
|
|
|
2012-10-27 23:41:02 +02:00
|
|
|
/**
|
|
|
|
* PacketTileUpdate
|
|
|
|
*
|
2012-12-19 19:09:56 +01:00
|
|
|
* Packet specifically for updating/synching tile entities between client and
|
|
|
|
* server
|
2012-10-27 23:41:02 +02:00
|
|
|
*
|
|
|
|
* @author pahimar
|
|
|
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
|
|
|
*
|
|
|
|
*/
|
2012-09-21 22:13:21 +02:00
|
|
|
public class PacketTileUpdate extends PacketEE {
|
|
|
|
|
2012-12-19 19:09:56 +01:00
|
|
|
public int x, y, z;
|
|
|
|
public byte direction;
|
|
|
|
public short state;
|
|
|
|
public String player;
|
|
|
|
|
|
|
|
public PacketTileUpdate() {
|
|
|
|
|
|
|
|
super(PacketTypeHandler.TILE, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCoords(int x, int y, int z) {
|
|
|
|
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.z = z;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void writeData(DataOutputStream data) throws IOException {
|
|
|
|
|
|
|
|
data.writeInt(x);
|
|
|
|
data.writeInt(y);
|
|
|
|
data.writeInt(z);
|
|
|
|
data.writeByte(direction);
|
|
|
|
data.writeShort(state);
|
|
|
|
data.writeUTF(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void readData(DataInputStream data) throws IOException {
|
|
|
|
|
|
|
|
this.x = data.readInt();
|
|
|
|
this.y = data.readInt();
|
|
|
|
this.z = data.readInt();
|
|
|
|
this.direction = data.readByte();
|
|
|
|
this.state = data.readShort();
|
|
|
|
this.player = data.readUTF();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void execute(INetworkManager manager, Player player) {
|
|
|
|
|
|
|
|
// TODO: Stuff here
|
|
|
|
}
|
|
|
|
|
2012-09-21 22:13:21 +02:00
|
|
|
}
|