2015-03-07 12:51:28 +01:00
|
|
|
package ellpeck.actuallyadditions.tile;
|
2014-12-12 15:40:01 +01:00
|
|
|
|
2015-02-17 16:15:16 +01:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2015-03-29 15:29:05 +02:00
|
|
|
import ellpeck.actuallyadditions.util.ModUtil;
|
2015-03-07 12:51:28 +01:00
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
2015-03-07 02:23:31 +01:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.BlockAir;
|
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-03-07 02:23:31 +01:00
|
|
|
import net.minecraft.world.World;
|
2014-12-12 15:40:01 +01:00
|
|
|
|
2015-03-07 02:23:31 +01:00
|
|
|
public class TileEntityBase extends TileEntity{
|
2014-12-12 15:40:01 +01:00
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2014-12-12 15:40:01 +01:00
|
|
|
public Packet getDescriptionPacket(){
|
|
|
|
NBTTagCompound compound = new NBTTagCompound();
|
|
|
|
this.writeToNBT(compound);
|
2015-02-17 16:15:16 +01:00
|
|
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), compound);
|
2014-12-12 15:40:01 +01:00
|
|
|
}
|
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2014-12-12 15:40:01 +01:00
|
|
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet){
|
|
|
|
super.onDataPacket(net, packet);
|
2015-02-17 16:15:16 +01:00
|
|
|
this.readFromNBT(packet.func_148857_g());
|
|
|
|
}
|
|
|
|
|
2014-12-18 19:24:06 +01:00
|
|
|
public static void init(){
|
2015-02-09 17:25:05 +01:00
|
|
|
Util.logInfo("Registering TileEntities...");
|
2015-03-29 15:29:05 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID_LOWER + ":tileEntityCompost");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityFeeder.class, ModUtil.MOD_ID_LOWER + ":tileEntityFeeder");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityGiantChest.class, ModUtil.MOD_ID_LOWER + ":tileEntityGiantChest");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityGrinder.class, ModUtil.MOD_ID_LOWER + ":tileEntityGrinder");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityFurnaceDouble.class, ModUtil.MOD_ID_LOWER + ":tileEntityFurnaceDouble");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityInputter.class, ModUtil.MOD_ID_LOWER + ":tileEntityInputter");
|
2015-03-30 15:08:19 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityFishingNet.class, ModUtil.MOD_ID_LOWER + ":tileEntityFishingNet");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityFurnaceSolar.class, ModUtil.MOD_ID_LOWER + ":tileEntityFurnaceSolar");
|
2015-03-31 20:37:55 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityHeatCollector.class, ModUtil.MOD_ID_LOWER + ":tileEntityHeatCollector");
|
2015-04-02 12:06:42 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID_LOWER + ":tileEntityRepairer");
|
2014-12-18 19:24:06 +01:00
|
|
|
}
|
2015-03-07 02:23:31 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){
|
|
|
|
return newBlock == null || newBlock instanceof BlockAir;
|
|
|
|
}
|
|
|
|
}
|