2015-01-30 20:16:32 +01:00
|
|
|
package ellpeck.someprettyrandomstuff.tile;
|
2014-12-12 15:40:01 +01:00
|
|
|
|
2015-02-09 17:25:05 +01:00
|
|
|
import ellpeck.someprettyrandomstuff.util.Util;
|
2014-12-12 15:40:01 +01:00
|
|
|
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;
|
2015-02-09 17:25:05 +01:00
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
2014-12-12 15:40:01 +01:00
|
|
|
|
2015-02-09 17:25:05 +01:00
|
|
|
public abstract class TileEntityBase extends TileEntity{
|
2014-12-12 15:40:01 +01:00
|
|
|
|
|
|
|
public Packet getDescriptionPacket(){
|
|
|
|
NBTTagCompound compound = new NBTTagCompound();
|
|
|
|
this.writeToNBT(compound);
|
2015-02-09 17:25:05 +01:00
|
|
|
return new S35PacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), compound);
|
2014-12-12 15:40:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet){
|
|
|
|
super.onDataPacket(net, packet);
|
2015-02-09 17:25:05 +01:00
|
|
|
this.readFromNBT(packet.getNbtCompound());
|
2014-12-12 15:40:01 +01:00
|
|
|
}
|
|
|
|
|
2014-12-18 19:24:06 +01:00
|
|
|
public static void init(){
|
2015-02-09 17:25:05 +01:00
|
|
|
Util.logInfo("Registering TileEntities...");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityCompost.class, Util.MOD_ID + ":tileEntityCompost");
|
2014-12-18 19:24:06 +01:00
|
|
|
}
|
2014-12-12 15:40:01 +01:00
|
|
|
}
|