| package com.mod.panda.entity; |
| |
| import com.mod.panda.References; |
| import com.mod.panda.init.items; |
| |
| import cpw.mods.fml.relauncher.Side; |
| import cpw.mods.fml.relauncher.SideOnly; |
| import net.minecraft.client.Minecraft; |
| import net.minecraft.client.audio.PositionedSoundRecord; |
| import net.minecraft.entity.IRangedAttackMob; |
| import net.minecraft.entity.SharedMonsterAttributes; |
| import net.minecraft.entity.ai.EntityAIArrowAttack; |
| import net.minecraft.entity.ai.EntityAIAttackOnCollide; |
| import net.minecraft.entity.ai.EntityAIHurtByTarget; |
| import net.minecraft.entity.ai.EntityAILookIdle; |
| import net.minecraft.entity.ai.EntityAIMoveThroughVillage; |
| import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; |
| 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.BossStatus; |
| import net.minecraft.entity.boss.IBossDisplayData; |
| import net.minecraft.entity.effect.EntityLightningBolt; |
| import net.minecraft.entity.item.EntityXPOrb; |
| 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.util.MathHelper; |
| import net.minecraft.util.ResourceLocation; |
| import net.minecraft.world.IBlockAccess; |
| import net.minecraft.world.World; |
| import net.minecraftforge.common.ForgeModContainer; |
| |
| public class EntityPanda extends EntityMob implements IBossDisplayData |
| { |
| |
| public EntityPanda(World p_i1738_1_) |
| { |
| super(p_i1738_1_); |
| isImmuneToFire = true; |
| this.experienceValue = 200; |
| this.getNavigator().setBreakDoors(true); |
| this.tasks.addTask(0, new EntityAISwimming(this)); |
| this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 100.0D, false)); |
| this.tasks.addTask(7, new EntityAIWander(this, 20.0D)); |
| this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 64.0F)); |
| this.tasks.addTask(8, new EntityAILookIdle(this)); |
| this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); |
| this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); |
| this.setSize(0.3F, 2.2F); |
| } |
| protected String getHurtSound() |
| { |
| return References.MOD_ID + ":mob.panda.hurt"; |
| } |
| |
| |
| |
| |
| protected String getLivingSound() |
| { |
| return References.MOD_ID + ":mob.panda.living"; |
| } |
| protected void applyEntityAttributes() |
| { |
| super.applyEntityAttributes(); |
| this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D); |
| this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(100.0D); |
| this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2300.0D); |
| this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.0D); |
| } |
| protected Item getDropItem() |
| { |
| return items.panda_leather; |
| } |
| protected Item getRareDropItem() |
| { |
| return items.panda_sword; |
| } |
| public int deathTick = 0; |
| public static int textureEvent = 0; |
| public void onDeathUpdate() |
| { |
| if (deathTick < 79) |
| { |
| ++deathTick; |
| if (deathTick > 2) |
| { |
| this.moveEntity(0.0D, 0.1D, 0.0D); |
| this.renderYawOffset = this.rotationYaw += 20.0F; |
| } |
| } |
| else |
| { |
| super.onDeathUpdate(); |
| } |
| if(deathTick == 78) |
| { |
| float f = (this.rand.nextFloat() - 0.5F) * 8.0F; |
| float f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; |
| float f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; |
| this.worldObj.spawnParticle("hugeexplosion", this.posX + (double)f, this.posY + 2.0D + (double)f1, this.posZ + (double)f2, 0.0D, 0.0D, 0.0D); |
| this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "minecraft:random.explode", 5.0F, 1.0F); |
| } |
| if(deathTick == 1) |
| { |
| Minecraft.getMinecraft().getSoundHandler().stopSounds(); |
| } |
| if(deathTick == 2) |
| { |
| this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "pandamod:death", 5.0F, 1.0F); |
| textureEvent = 1; |
| } |
| } |
| public int tick = 0; |
| public void onUpdate() |
| { |
| if(tick < 385) |
| { |
| ++tick; |
| this.setPosition(this.posX, this.posY+0.015, this.posZ); |
| this.heal(6); |
| } |
| else |
| { |
| super.onUpdate(); |
| } |
| if(tick == 1) |
| { |
| this.setHealth(1F); |
| textureEvent = 1; |
| } |
| if(tick == 128) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 160) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 184) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 192) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 224) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 246) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 248) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 250) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 252) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 256) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 288) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 312) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 320) |
| { |
| this.spawnExplosionParticle(); |
| this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); |
| } |
| if(tick == 384) |
| { |
| this.setPosition(this.posX, this.posY-2, this.posZ); |
| } |
| if(tick == 383) |
| { |
| this.spawnExplosionParticle(); |
| float f = (this.rand.nextFloat() - 0.5F) * 8.0F; |
| float f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; |
| float f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; |
| this.worldObj.spawnParticle("hugeexplosion", this.posX + (double)f, this.posY + 2.0D + (double)f1, this.posZ + (double)f2, 0.0D, 0.0D, 0.0D); |
| this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "minecraft:random.explode", 5.0F, 1.0F); |
| textureEvent = 0; |
| } |
| } |
| } |