Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 116 lines 3.9 kB view raw
1package net.minecraft.server; 2 3import com.legacyminecraft.poseidon.PoseidonConfig; 4// CraftBukkit start 5import org.bukkit.event.entity.EntityCombustEvent; 6import org.bukkit.event.entity.EntityDeathEvent; 7// CraftBukkit end 8 9public class EntitySkeleton extends EntityMonster { 10 11 private static final ItemStack a = new ItemStack(Item.BOW, 1); 12 13 public EntitySkeleton(World world) { 14 super(world); 15 this.texture = "/mob/skeleton.png"; 16 } 17 18 protected String g() { 19 return "mob.skeleton"; 20 } 21 22 protected String h() { 23 return "mob.skeletonhurt"; 24 } 25 26 protected String i() { 27 return "mob.skeletonhurt"; 28 } 29 30 public void v() { 31 if (this.world.d()) { 32 float f = this.c(1.0F); 33 34 if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { 35 // CraftBukkit start 36 EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity()); 37 this.world.getServer().getPluginManager().callEvent(event); 38 39 if (!event.isCancelled()) { 40 this.fireTicks = 300; 41 } 42 // CraftBukkit end 43 } 44 } 45 46 super.v(); 47 } 48 49 protected void a(Entity entity, float f) { 50 if (f < 10.0F) { 51 double d0 = entity.locX - this.locX; 52 double d1 = entity.locZ - this.locZ; 53 54 if (this.attackTicks == 0) { 55 EntityArrow entityarrow = new EntityArrow(this.world, this); 56 57 ++entityarrow.locY; 58 double d2 = entity.locY + (double) entity.t() - 0.20000000298023224D - entityarrow.locY; 59 float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F; 60 61 62 if ((boolean) PoseidonConfig.getInstance().getConfigOption("world.settings.skeleton-shooting-sound-fix.enabled", true)) { 63 64 this.world.e(1002, MathHelper.floor(this.locX), MathHelper.floor(this.locY - (double) this.height), MathHelper.floor(this.locZ), 0); // Poseidon - fix skeleton bow sounds (Strultz) 65 } else { 66 this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); 67 } 68 69 entityarrow.a(d0, d2 + (double) f1, d1, 0.6F, 12.0F); 70 this.world.addEntity(entityarrow); 71 this.attackTicks = 30; 72 } 73 74 this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; 75 this.e = true; 76 } 77 } 78 79 public void b(NBTTagCompound nbttagcompound) { 80 super.b(nbttagcompound); 81 } 82 83 public void a(NBTTagCompound nbttagcompound) { 84 super.a(nbttagcompound); 85 } 86 87 protected int j() { 88 return Item.ARROW.id; 89 } 90 91 protected void q() { 92 // CraftBukkit start - whole method 93 java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); 94 95 int count = this.random.nextInt(3); 96 if (count > 0) { 97 loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.ARROW, count)); 98 } 99 100 count = this.random.nextInt(3); 101 if (count > 0) { 102 loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count)); 103 } 104 105 org.bukkit.World bworld = this.world.getWorld(); 106 org.bukkit.entity.Entity entity = this.getBukkitEntity(); 107 108 EntityDeathEvent event = new EntityDeathEvent(entity, loot); 109 this.world.getServer().getPluginManager().callEvent(event); 110 111 for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { 112 bworld.dropItemNaturally(entity.getLocation(), stack); 113 } 114 // CraftBukkit end 115 } 116}