Files
Electro-Magic-Tools/src/main/java/emt/tile/TileEntityEMT.java
T
bartimaeusnek 028f5ef031 fixed a few bugs, removed unused variables & imports
+added a ingame book containing the fuelmap
2018-09-04 08:00:47 +02:00

53 lines
1.3 KiB
Java

package emt.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileEntityEMT
extends TileEntity
{
public int facing;
public boolean isOn;
public void readFromNBT(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
this.facing = tagCompound.getInteger("facing");
this.isOn = tagCompound.getBoolean("isOn");
}
public void writeToNBT(NBTTagCompound tagCompound)
{
tagCompound.setInteger("facing", this.facing);
tagCompound.setBoolean("isOn", this.isOn);
super.writeToNBT(tagCompound);
}
public final Packet getDescriptionPacket()
{
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
return packet;
}
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
{
NBTTagCompound nbt = pkt.func_148857_g();
readFromNBT(nbt);
}
public void markDirty()
{
super.markDirty();
if (this.worldObj.isRemote) {
return;
}
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}