diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-10-24 22:53:23 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-27 22:19:03 -0400 |
commit | 60819c6693daf19dde68b04af38a4fee8c7da988 (patch) | |
tree | e7bd96a07f0e9d9f1f6b2721ddd1bb5dd71eaf48 /src/main/java/net/minecraft/server/EntityPig.java | |
parent | b9a72531b6e2ccc84bd021bca421255a957d96f7 (diff) | |
download | craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.gz craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.lz craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.tar.xz craftbukkit-60819c6693daf19dde68b04af38a4fee8c7da988.zip |
Update CraftBukkit to Minecraft 1.4(.2).
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityPig.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityPig.java | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java index a66c26f2..62e9c14f 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -4,6 +4,8 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit public class EntityPig extends EntityAnimal { + private final PathfinderGoalPassengerCarrotStick d; + public EntityPig(World world) { super(world); this.texture = "/mob/pig.png"; @@ -13,15 +15,17 @@ public class EntityPig extends EntityAnimal { this.goalSelector.a(0, new PathfinderGoalFloat(this)); this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F)); - this.goalSelector.a(2, new PathfinderGoalBreed(this, f)); - this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false)); - this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.28F)); - this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, f)); - this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); - this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this)); + this.goalSelector.a(2, this.d = new PathfinderGoalPassengerCarrotStick(this, 0.34F)); + this.goalSelector.a(3, new PathfinderGoalBreed(this, f)); + this.goalSelector.a(4, new PathfinderGoalTempt(this, 0.3F, Item.CARROT_STICK.id, false)); + this.goalSelector.a(4, new PathfinderGoalTempt(this, 0.3F, Item.CARROT.id, false)); + this.goalSelector.a(5, new PathfinderGoalFollowParent(this, 0.28F)); + this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, f)); + this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); + this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); } - public boolean aV() { + public boolean bb() { return true; } @@ -29,6 +33,16 @@ public class EntityPig extends EntityAnimal { return 10; } + protected void bi() { + super.bi(); + } + + public boolean bF() { + ItemStack itemstack = ((EntityHuman) this.passenger).bA(); + + return itemstack != null && itemstack.id == Item.CARROT_STICK.id; + } + protected void a() { super.a(); this.datawatcher.a(16, Byte.valueOf((byte) 0)); @@ -44,16 +58,20 @@ public class EntityPig extends EntityAnimal { this.setSaddle(nbttagcompound.getBoolean("Saddle")); } - protected String aQ() { - return "mob.pig"; + protected String aW() { + return "mob.pig.say"; + } + + protected String aX() { + return "mob.pig.say"; } - protected String aR() { - return "mob.pig"; + protected String aY() { + return "mob.pig.death"; } - protected String aS() { - return "mob.pigdeath"; + protected void a(int i, int j, int k, int l) { + this.world.makeSound(this, "mob.pig.step", 0.15F, 1.0F); } public boolean c(EntityHuman entityhuman) { @@ -84,6 +102,10 @@ public class EntityPig extends EntityAnimal { } } + if (this.hasSaddle()) { + loot.add(new org.bukkit.inventory.ItemStack(Item.SADDLE.id, 1)); + } + CraftEventFactory.callEntityDeathEvent(this, loot); // CraftBukkit end } @@ -127,4 +149,12 @@ public class EntityPig extends EntityAnimal { public EntityAnimal createChild(EntityAnimal entityanimal) { return new EntityPig(this.world); } + + public boolean c(ItemStack itemstack) { + return itemstack != null && itemstack.id == Item.CARROT.id; + } + + public PathfinderGoalPassengerCarrotStick n() { + return this.d; + } } |