001 package net.minecraft.entity.boss;
002
003 import net.minecraft.entity.Entity;
004 import net.minecraft.entity.IEntityMultiPart;
005 import net.minecraft.nbt.NBTTagCompound;
006 import net.minecraft.util.DamageSource;
007
008 public class EntityDragonPart extends Entity
009 {
010 /** The dragon entity this dragon part belongs to */
011 public final IEntityMultiPart entityDragonObj;
012
013 /** The name of the Dragon Part */
014 public final String name;
015
016 public EntityDragonPart(IEntityMultiPart par1, String par2, float par3, float par4)
017 {
018 super(par1.func_82194_d());
019 this.setSize(par3, par4);
020 this.entityDragonObj = par1;
021 this.name = par2;
022 }
023
024 protected void entityInit() {}
025
026 /**
027 * (abstract) Protected helper method to read subclass entity data from NBT.
028 */
029 protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {}
030
031 /**
032 * (abstract) Protected helper method to write subclass entity data to NBT.
033 */
034 protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {}
035
036 /**
037 * Returns true if other Entities should be prevented from moving through this Entity.
038 */
039 public boolean canBeCollidedWith()
040 {
041 return true;
042 }
043
044 /**
045 * Called when the entity is attacked.
046 */
047 public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
048 {
049 return this.isEntityInvulnerable() ? false : this.entityDragonObj.attackEntityFromPart(this, par1DamageSource, par2);
050 }
051
052 /**
053 * Returns true if Entity argument is equal to this Entity
054 */
055 public boolean isEntityEqual(Entity par1Entity)
056 {
057 return this == par1Entity || this.entityDragonObj == par1Entity;
058 }
059 }