summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityPig.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityPig.java')
-rw-r--r--src/main/java/net/minecraft/server/EntityPig.java56
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;
+ }
}