Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 103 lines 2.9 kB view raw
1package net.minecraft.server; 2 3// CraftBukkit start 4 5import org.bukkit.craftbukkit.entity.CraftEntity; 6import org.bukkit.event.entity.EntityTargetEvent; 7// CraftBukkit end 8 9//uberbukkit start 10import uk.betacraft.uberbukkit.UberbukkitConfig; 11//uberbukkit end 12 13public class EntitySpider extends EntityMonster { 14 15 public EntitySpider(World world) { 16 super(world); 17 this.texture = "/mob/spider.png"; 18 this.b(1.4F, 0.9F); 19 this.aE = 0.8F; 20 } 21 22 public double m() { 23 return (double) this.width * 0.75D - 0.5D; 24 } 25 26 protected boolean n() { 27 return UberbukkitConfig.getInstance().getBoolean("mechanics.spiders_trample_crops", false); 28 } 29 30 protected Entity findTarget() { 31 float f = this.c(1.0F); 32 33 if (f < 0.5F) { 34 double d0 = 16.0D; 35 36 return this.world.findNearbyPlayer(this, d0); 37 } else { 38 return null; 39 } 40 } 41 42 protected String g() { 43 return "mob.spider"; 44 } 45 46 protected String h() { 47 return "mob.spider"; 48 } 49 50 protected String i() { 51 return "mob.spiderdeath"; 52 } 53 54 protected void a(Entity entity, float f) { 55 float f1 = this.c(1.0F); 56 57 if (f1 > 0.5F && this.random.nextInt(100) == 0) { 58 // CraftBukkit start 59 EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.FORGOT_TARGET); 60 this.world.getServer().getPluginManager().callEvent(event); 61 62 if (!event.isCancelled()) { 63 if (event.getTarget() == null) { 64 this.target = null; 65 } else { 66 this.target = ((CraftEntity) event.getTarget()).getHandle(); 67 } 68 return; 69 } 70 // CraftBukkit end 71 } else { 72 if (f > 2.0F && f < 6.0F && this.random.nextInt(10) == 0) { 73 if (this.onGround) { 74 double d0 = entity.locX - this.locX; 75 double d1 = entity.locZ - this.locZ; 76 float f2 = MathHelper.a(d0 * d0 + d1 * d1); 77 78 this.motX = d0 / (double) f2 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D; 79 this.motZ = d1 / (double) f2 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D; 80 this.motY = 0.4000000059604645D; 81 } 82 } else { 83 super.a(entity, f); 84 } 85 } 86 } 87 88 public void b(NBTTagCompound nbttagcompound) { 89 super.b(nbttagcompound); 90 } 91 92 public void a(NBTTagCompound nbttagcompound) { 93 super.a(nbttagcompound); 94 } 95 96 protected int j() { 97 return Item.STRING.id; 98 } 99 100 public boolean p() { 101 return UberbukkitConfig.getInstance().getBoolean("mechanics.spiders_climb_walls", true) ? this.positionChanged : super.p(); 102 } 103}