001package net.minecraft.tileentity; 002 003import net.minecraft.nbt.NBTTagCompound; 004import net.minecraft.network.packet.Packet; 005import net.minecraft.network.packet.Packet132TileEntityData; 006 007public class TileEntityMobSpawner extends TileEntity 008{ 009 private final MobSpawnerBaseLogic field_98050_a = new TileEntityMobSpawnerLogic(this); 010 011 /** 012 * Reads a tile entity from NBT. 013 */ 014 public void readFromNBT(NBTTagCompound par1NBTTagCompound) 015 { 016 super.readFromNBT(par1NBTTagCompound); 017 this.field_98050_a.func_98270_a(par1NBTTagCompound); 018 } 019 020 /** 021 * Writes a tile entity to NBT. 022 */ 023 public void writeToNBT(NBTTagCompound par1NBTTagCompound) 024 { 025 super.writeToNBT(par1NBTTagCompound); 026 this.field_98050_a.func_98280_b(par1NBTTagCompound); 027 } 028 029 /** 030 * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count 031 * ticks and creates a new spawn inside its implementation. 032 */ 033 public void updateEntity() 034 { 035 this.field_98050_a.updateSpawner(); 036 super.updateEntity(); 037 } 038 039 /** 040 * Overriden in a sign to provide the text. 041 */ 042 public Packet getDescriptionPacket() 043 { 044 NBTTagCompound nbttagcompound = new NBTTagCompound(); 045 this.writeToNBT(nbttagcompound); 046 nbttagcompound.removeTag("SpawnPotentials"); 047 return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound); 048 } 049 050 /** 051 * Called when a client event is received with the event number and argument, see World.sendClientEvent 052 */ 053 public boolean receiveClientEvent(int par1, int par2) 054 { 055 return this.field_98050_a.func_98268_b(par1) ? true : super.receiveClientEvent(par1, par2); 056 } 057 058 public MobSpawnerBaseLogic func_98049_a() 059 { 060 return this.field_98050_a; 061 } 062}