001package net.minecraft.entity.ai;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.block.Block;
006import net.minecraft.entity.item.EntityMinecart;
007import net.minecraft.nbt.NBTTagCompound;
008import net.minecraft.tileentity.MobSpawnerBaseLogic;
009import net.minecraft.world.World;
010
011public class EntityMinecartMobSpawner extends EntityMinecart
012{
013    /** Mob spawner logic for this spawner minecart. */
014    private final MobSpawnerBaseLogic mobSpawnerLogic = new EntityMinecartMobSpawnerLogic(this);
015
016    public EntityMinecartMobSpawner(World par1World)
017    {
018        super(par1World);
019    }
020
021    public EntityMinecartMobSpawner(World par1World, double par2, double par4, double par6)
022    {
023        super(par1World, par2, par4, par6);
024    }
025
026    public int getMinecartType()
027    {
028        return 4;
029    }
030
031    public Block getDefaultDisplayTile()
032    {
033        return Block.mobSpawner;
034    }
035
036    /**
037     * (abstract) Protected helper method to read subclass entity data from NBT.
038     */
039    protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
040    {
041        super.readEntityFromNBT(par1NBTTagCompound);
042        this.mobSpawnerLogic.readFromNBT(par1NBTTagCompound);
043    }
044
045    /**
046     * (abstract) Protected helper method to write subclass entity data to NBT.
047     */
048    protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
049    {
050        super.writeEntityToNBT(par1NBTTagCompound);
051        this.mobSpawnerLogic.writeToNBT(par1NBTTagCompound);
052    }
053
054    @SideOnly(Side.CLIENT)
055    public void handleHealthUpdate(byte par1)
056    {
057        this.mobSpawnerLogic.setDelayToMin(par1);
058    }
059
060    /**
061     * Called to update the entity's position/logic.
062     */
063    public void onUpdate()
064    {
065        super.onUpdate();
066        this.mobSpawnerLogic.updateSpawner();
067    }
068
069    @SideOnly(Side.CLIENT)
070    public MobSpawnerBaseLogic func_98039_d()
071    {
072        return this.mobSpawnerLogic;
073    }
074}