ActuallyAdditions/src/main/java/ellpeck/someprettyrandomstuff/tile/TileEntityBase.java
Ellpeck ad1fbe7101 Changed Feeder and added Packet Handling.
Also diesieben07 made me change stuff.
2015-02-20 22:45:33 +01:00

33 lines
1.3 KiB
Java

package ellpeck.someprettyrandomstuff.tile;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.util.Util;
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 abstract class TileEntityBase extends TileEntity{
@Override
public Packet getDescriptionPacket(){
NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), compound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet){
super.onDataPacket(net, packet);
this.readFromNBT(packet.func_148857_g());
}
public static void init(){
Util.logInfo("Registering TileEntities...");
GameRegistry.registerTileEntity(TileEntityCompost.class, Util.MOD_ID_LOWER + ":tileEntityCompost");
GameRegistry.registerTileEntity(TileEntityFeeder.class, Util.MOD_ID_LOWER + ":tileEntityFeeder");
GameRegistry.registerTileEntity(TileEntityGiantChest.class, Util.MOD_ID_LOWER + ":tileEntityGiantChest");
}
}