Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. package net.EternIsles.boss.kror;
  2.  
  3. import net.EternIsles.common.eternisles;
  4. import net.EternIsles.izer.Itemizer;
  5. import net.EternIsles.izer.Weaponizer;
  6. import net.minecraft.block.Block;
  7. import net.minecraft.entity.Entity;
  8. import net.minecraft.entity.EntityLiving;
  9. import net.minecraft.entity.EntityLivingBase;
  10. import net.minecraft.entity.SharedMonsterAttributes;
  11. import net.minecraft.entity.monster.EntityMob;
  12. import net.minecraft.entity.player.EntityPlayer;
  13. import net.minecraft.entity.projectile.EntityArrow;
  14. import net.minecraft.entity.projectile.EntityThrowable;
  15. import net.minecraft.potion.Potion;
  16. import net.minecraft.potion.PotionEffect;
  17. import net.minecraft.util.DamageSource;
  18. import net.minecraft.util.Vec3;
  19. import net.minecraft.world.EnumDifficulty;
  20. import net.minecraft.world.World;
  21.  
  22. public class EntityKror extends EntityMob {
  23. private int musicTick = 1;
  24.  
  25. public EntityKror(World par1World) {
  26. super(par1World);
  27. this.setSize(4.8F, 5.1F);
  28. // TODO Auto-generated constructor stub
  29. }
  30.  
  31. protected String getLivingSound() {
  32. return "eternisles:KrorLiving";
  33. }
  34.  
  35. protected String getDeathSound() {
  36. return "eternisles:KrorDeath";
  37. }
  38.  
  39. protected String getHurtSound() {
  40. return "eternisles:KrorLiving";
  41. }
  42.  
  43. @Override
  44. protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) {
  45. this.playSound("eternisles:HeavyStep", 0.85F, 1.0F);
  46. }
  47.  
  48.  
  49. @Override
  50. protected void dropFewItems(boolean par1, int par2) {
  51.  
  52. }
  53.  
  54.  
  55. @Override
  56. public void onDeath(DamageSource d) {
  57. super.onDeath(d);
  58. if(worldObj.isRemote){
  59. eternisles.sendMessageToAll("Kror has crumbled apart.");
  60. }
  61. }
  62.  
  63.  
  64.  
  65. @Override
  66. public void onLivingUpdate() {
  67. super.onLivingUpdate();
  68.  
  69. this.musicTick--;
  70. if (this.musicTick == 0){
  71. this.musicTick = 310;
  72. this.playSound("eternisles:MusicKror", 2.80F, 1.0F);
  73.  
  74. }
  75. EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 64.0D);
  76.  
  77. if (var1 == null)
  78. return;
  79. else
  80. {
  81. Vec3 var3 = var1.getLook(1.0F).normalize();
  82. Vec3 var4 = Vec3.createVectorHelper(this.posX - var1.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - var1.posY + (double)var1.getEyeHeight(), this.posZ - var1.posZ);
  83. double var5 = var4.lengthVector();
  84. var4 = var4.normalize();
  85. double var7 = var3.dotProduct(var4);
  86. if( var7 > 1.0D - 0.025D / var5 && var1.canEntityBeSeen(this))
  87. {
  88. var1.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 80, 50));
  89. }
  90. }
  91. }
  92.  
  93. protected Entity findPlayerToAttack() {
  94. EntityPlayer entityPlayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
  95. return entityPlayer != null && this.canEntityBeSeen(entityPlayer) ? entityPlayer : null;
  96.  
  97. }
  98.  
  99. public void applyEntityAttributes() {
  100. super.applyEntityAttributes();
  101.  
  102. this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(60.0D);
  103. this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(52.0D);
  104. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
  105. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  106. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2200.0D);
  107. }
  108.  
  109. @Override
  110. public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
  111. Entity entity;
  112. entity = par1DamageSource.getSourceOfDamage();
  113. if (entity instanceof EntityThrowable) {
  114. ((EntityThrowable) entity).getThrower().attackEntityFrom(DamageSource.causeMobDamage(this), par2/3);
  115. }
  116.  
  117. if (entity instanceof EntityArrow) {
  118. par1DamageSource.getEntity().attackEntityFrom(DamageSource.causeMobDamage(this), par2/3);
  119. }
  120. return super.attackEntityFrom(par1DamageSource, par2);
  121. }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement