2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.blocks.logic;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2014-01-10 21:14:54 -05:00
|
|
|
import net.minecraft.network.NetworkManager;
|
2013-12-31 16:37:46 -05:00
|
|
|
import net.minecraft.network.Packet;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.network.packet.Packet132TileEntityData;
|
|
|
|
|
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-01-18 02:52:49 -05:00
|
|
|
public void func_145839_a (NBTTagCompound tags)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-01-18 02:52:49 -05:00
|
|
|
super.func_145839_a(tags);
|
2013-07-26 21:18:53 -07:00
|
|
|
readCustomNBT(tags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-01-18 02:52:49 -05:00
|
|
|
public void func_145841_b (NBTTagCompound tags)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-01-18 02:52:49 -05:00
|
|
|
super.func_145841_b(tags);
|
2013-07-26 21:18:53 -07:00
|
|
|
writeCustomNBT(tags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Packets */
|
|
|
|
|
@Override
|
|
|
|
|
public Packet getDescriptionPacket ()
|
|
|
|
|
{
|
|
|
|
|
NBTTagCompound tag = new NBTTagCompound();
|
|
|
|
|
writeCustomNBT(tag);
|
2014-01-08 21:59:48 -05:00
|
|
|
return new Packet132TileEntityData(field_145851_c, field_145848_d, field_145849_e, 1, tag);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-01-10 21:14:54 -05:00
|
|
|
public void onDataPacket (NetworkManager net, Packet132TileEntityData packet)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2013-09-07 01:35:45 -04:00
|
|
|
readCustomNBT(packet.data);
|
2014-01-08 21:59:48 -05:00
|
|
|
field_145850_b.markBlockForRenderUpdate(field_145851_c, field_145848_d, field_145849_e);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
}
|