2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.blocks.logic;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2014-02-05 10:28:54 -05:00
|
|
|
import net.minecraft.network.NetworkManager;
|
|
|
|
|
import net.minecraft.network.Packet;
|
2014-02-01 17:28:41 +11:00
|
|
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
|
|
|
|
|
public class RedwireLogic extends TileEntity
|
|
|
|
|
{
|
|
|
|
|
byte facesUsed;
|
|
|
|
|
byte type;
|
|
|
|
|
byte distanceTravelled;
|
|
|
|
|
byte maxDistance;
|
|
|
|
|
|
|
|
|
|
public void readCustomNBT (NBTTagCompound tags)
|
|
|
|
|
{
|
|
|
|
|
/*hasMaster = tags.getBoolean("HasMaster");
|
|
|
|
|
if (hasMaster)
|
|
|
|
|
{
|
|
|
|
|
int xCenter = tags.getInteger("xCenter");
|
|
|
|
|
int yCenter = tags.getInteger("yCenter");
|
|
|
|
|
int zCenter = tags.getInteger("zCenter");
|
|
|
|
|
master = new CoordTuple(xCenter, yCenter, zCenter);
|
|
|
|
|
masterID = tags.getShort("MasterID");
|
|
|
|
|
masterMeat = tags.getByte("masterMeat");
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void writeCustomNBT (NBTTagCompound tags)
|
|
|
|
|
{
|
|
|
|
|
/*tags.setBoolean("HasMaster", hasMaster);
|
|
|
|
|
if (hasMaster)
|
|
|
|
|
{
|
|
|
|
|
tags.setInteger("xCenter", master.x);
|
|
|
|
|
tags.setInteger("yCenter", master.y);
|
|
|
|
|
tags.setInteger("zCenter", master.z);
|
|
|
|
|
tags.setShort("MasterID", masterID);
|
|
|
|
|
tags.setByte("masterMeat", masterMeat);
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-02-05 08:28:53 -05:00
|
|
|
public void readFromNBT (NBTTagCompound tags)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-02-05 08:28:53 -05:00
|
|
|
super.readFromNBT(tags);
|
2013-07-26 21:18:53 -07:00
|
|
|
readCustomNBT(tags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-02-05 08:28:53 -05:00
|
|
|
public void writeToNBT (NBTTagCompound tags)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-02-05 08:28:53 -05:00
|
|
|
super.writeToNBT(tags);
|
2013-07-26 21:18:53 -07:00
|
|
|
writeCustomNBT(tags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Packets */
|
|
|
|
|
@Override
|
2014-02-05 08:28:53 -05:00
|
|
|
public Packet getDescriptionPacket ()
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
|
|
|
|
NBTTagCompound tag = new NBTTagCompound();
|
|
|
|
|
writeCustomNBT(tag);
|
2014-02-05 08:28:53 -05:00
|
|
|
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-02-01 17:28:41 +11:00
|
|
|
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-02-01 17:28:41 +11:00
|
|
|
readCustomNBT(packet.func_148857_g());
|
2014-02-05 08:28:53 -05:00
|
|
|
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
}
|