Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dpmod3rdimpact;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLiving;
- import net.minecraft.entity.EnumCreatureAttribute;
- import net.minecraft.entity.ai.EntityAIAttackOnCollide;
- import net.minecraft.entity.ai.EntityAIBreakDoor;
- import net.minecraft.entity.ai.EntityAIHurtByTarget;
- import net.minecraft.entity.ai.EntityAILookIdle;
- import net.minecraft.entity.ai.EntityAIMoveThroughVillage;
- import net.minecraft.entity.ai.EntityAIMoveTwardsRestriction;
- import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
- import net.minecraft.entity.ai.EntityAISwimming;
- import net.minecraft.entity.ai.EntityAIWander;
- import net.minecraft.entity.ai.EntityAIWatchClosest;
- import net.minecraft.entity.boss.IBossDisplayData;
- import net.minecraft.entity.item.EntityXPOrb;
- import net.minecraft.entity.monster.EntityCreeper;
- import net.minecraft.entity.monster.EntityMob;
- import net.minecraft.entity.passive.EntityVillager;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.Item;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.src.ModLoader;
- import net.minecraft.util.MathHelper;
- import net.minecraft.world.World;
- public class EntityMobName extends EntityMob
- {
- public EntityMobName(World par1World)
- {
- super(par1World);
- this.texture = "/MobName.png";
- this.moveSpeed = 0.30F;
- this.experienceValue = 1000;
- this.isImmuneToFire = true;
- this.setSize(this.width * 3.0F, this.height * 3.0F);
- this.getNavigator().setBreakDoors(true);
- this.tasks.addTask(0, new EntityAISwimming(this));
- this.tasks.addTask(1, new EntityAIBreakDoor(this));
- this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
- this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityVillager.class, this.moveSpeed, true));
- this.tasks.addTask(4, new EntityAIMoveTwardsRestriction(this, this.moveSpeed));
- this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, this.moveSpeed, false));
- this.tasks.addTask(6, new EntityAIWander(this, this.moveSpeed));
- this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
- this.tasks.addTask(7, new EntityAILookIdle(this));
- this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true));
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 16.0F, 0, false));
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreeper.class, 16.0F, 0, false));
- }
- public int getMaxHealth()
- {
- return 800;
- }
- protected void onDeathUpdate(EntityPlayer EntityPlayer)
- {
- ModLoader.openGUI(EntityPlayer, new GuiDefeatMobName());
- this.setDead();
- }
- /**
- * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
- */
- public int getTotalArmorValue()
- {
- return 2;
- }
- /**
- * Returns true if the newer Entity AI code should be run
- */
- protected boolean isAIEnabled()
- {
- return true;
- }
- /**
- * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
- * use this to react to sunlight and start to burn.
- /**
- * Returns the sound this mob makes while it's alive.
- */
- protected String getLivingSound()
- {
- return "";
- }
- /**
- * Returns the sound this mob makes when it is hurt.
- */
- protected String getHurtSound()
- {
- return "";
- }
- /**
- * Returns the sound this mob makes on death.
- */
- protected String getDeathSound()
- {
- return "";
- }
- @Override
- public void onLivingUpdate()
- {
- if (this.health == 0)
- {
- ModLoader.openGUI(attackingPlayer, new GuiDefeatMobName());
- }
- }
- /**
- * Returns the item ID for the item the mob drops on death.
- */
- /**
- * Get this Entity's EnumCreatureAttribute
- */
- public EnumCreatureAttribute getCreatureAttribute()
- {
- return EnumCreatureAttribute.UNDEAD;
- }
- public int getAttackStrength(Entity par1Entity)
- {
- return 8;
- }
- public int getDragonHealth() {
- return this.dataWatcher.getWatchableObjectInt(16);
- }
- public String getEntityName()
- {
- return "MobName";
- }
- public boolean attackEntityAsMob(Entity entity)
- {
- if (super.attackEntityAsMob(entity))
- {
- if (entity instanceof EntityLiving)
- {
- byte byte0 = 0;
- if (worldObj.difficultySetting > 1)
- {
- if (worldObj.difficultySetting == 2)
- {
- byte0 = 7;
- }
- else if (worldObj.difficultySetting == 3)
- {
- byte0 = 15;
- }
- }
- if (byte0 > 0)
- {
- ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.weakness.id, byte0 * 20, 0));
- }
- }
- return true;
- }
- else
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement