diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 610ffd4718..4fcba5c015 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -50,6 +50,16 @@ public int getId() { return this.id; +@@ -135,7 +169,8 @@ + this.dead = true; + } + +- protected void a(float f, float f1) { ++ // PAIL: Access + rename please ++ public void a(float f, float f1) { // CraftBukkit - protected to public + if (f != this.width || f1 != this.length) { + float f2 = this.width; + @@ -150,6 +184,33 @@ } diff --git a/nms-patches/EntityAgeable.patch b/nms-patches/EntityAgeable.patch index b537248be8..4abc0cf733 100644 --- a/nms-patches/EntityAgeable.patch +++ b/nms-patches/EntityAgeable.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityAgeable.java 2014-11-28 17:43:43.061707436 +0000 -+++ src/main/java/net/minecraft/server/EntityAgeable.java 2014-11-28 17:38:22.000000000 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/EntityAgeable.java Thu Dec 4 19:00:43 2014 ++++ src/main/java/net/minecraft/server/EntityAgeable.java Thu Dec 4 18:45:16 2014 @@ -7,6 +7,7 @@ protected int c; private float bk = -1.0F; @@ -46,3 +46,12 @@ if (this.c > 0) { if (this.c % 4 == 0) { this.world.addParticle(EnumParticle.VILLAGER_HAPPY, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); +@@ -146,7 +149,7 @@ + this.a(flag ? 0.5F : 1.0F); + } + +- protected final void a(float f, float f1) { ++ public final void a(float f, float f1) { // CraftBukkit - protected to public + boolean flag = this.bk > 0.0F; + + this.bk = f; diff --git a/nms-patches/EntityGuardian.patch b/nms-patches/EntityGuardian.patch new file mode 100644 index 0000000000..8c419e560c --- /dev/null +++ b/nms-patches/EntityGuardian.patch @@ -0,0 +1,21 @@ +--- ../work/decompile-8eb82bde//net/minecraft/server/EntityGuardian.java Thu Dec 11 13:57:14 2014 ++++ src/main/java/net/minecraft/server/EntityGuardian.java Thu Dec 11 13:55:14 2014 +@@ -14,7 +14,7 @@ + private EntityLiving bn; + private int bo; + private boolean bp; +- private PathfinderGoalRandomStroll bq; ++ public PathfinderGoalRandomStroll bq; // CraftBukkit - private to public + + public EntityGuardian(World world) { + super(world); +@@ -35,7 +35,8 @@ + this.c = this.b = this.random.nextFloat(); + } + +- protected void aW() { ++ // PAIL: Access + rename please ++ public void aW() { // CraftBukkit - protected to public + super.aW(); + this.getAttributeInstance(GenericAttributes.e).setValue(6.0D); + this.getAttributeInstance(GenericAttributes.d).setValue(0.5D); diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch index 42230d6e38..25dadd99f6 100644 --- a/nms-patches/EntityZombie.patch +++ b/nms-patches/EntityZombie.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityZombie.java 2014-11-28 17:43:43.185707433 +0000 -+++ src/main/java/net/minecraft/server/EntityZombie.java 2014-11-28 17:38:22.000000000 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/EntityZombie.java Thu Dec 11 13:57:17 2014 ++++ src/main/java/net/minecraft/server/EntityZombie.java Thu Dec 11 13:56:17 2014 @@ -4,6 +4,14 @@ import java.util.List; import java.util.UUID; @@ -106,3 +106,13 @@ entityvillager.addEffect(new MobEffect(MobEffectList.CONFUSION.id, 200, 0)); this.world.a((EntityHuman) null, 1017, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); } +@@ -487,7 +516,8 @@ + this.a(flag ? 0.5F : 1.0F); + } + +- protected final void a(float f, float f1) { ++ // PAIL: Access + rename please ++ public final void a(float f, float f1) { // CraftBukkit - protected to public + boolean flag = this.bo > 0.0F && this.bp > 0.0F; + + this.bo = f; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java index f254e809e9..d25a266608 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java @@ -1,6 +1,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityGuardian; +import net.minecraft.server.GenericAttributes; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Guardian; @@ -20,4 +21,30 @@ public class CraftGuardian extends CraftMonster implements Guardian { public EntityType getType() { return EntityType.GUARDIAN; } + + @Override + public boolean isElder() { + return ((EntityGuardian)entity).cl(); + } + + @Override + public void setElder( boolean shouldBeElder ) { + EntityGuardian entityGuardian = (EntityGuardian) entity; + + if (!isElder() && shouldBeElder) { + entityGuardian.a( true ); + } else if (isElder() && !shouldBeElder) { + entityGuardian.a( false ); + + // Since minecraft does not reset the elder Guardian to a guardian we have to do that + entity.a(0.85F, 0.85F); + entityGuardian.aW(); + + // Update pathfinding (random stroll back to 80) + entityGuardian.bq.b(80); + + // Tell minecraft that we need persistence since the guardian changed + entityGuardian.bW(); + } + } }