diff options
author | md_5 <git@md-5.net> | 2014-12-12 10:56:20 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-12-12 10:57:00 +1100 |
commit | 9fa497cd5568f2c232ef19f6c085dcca1a971ce0 (patch) | |
tree | 8f1c0681608788d8b31e7f54a793e8c07c91adeb /src/main/java | |
parent | 3b1c7d708e8b96da537b7a68867773329056cd75 (diff) | |
download | craftbukkit-9fa497cd5568f2c232ef19f6c085dcca1a971ce0.tar craftbukkit-9fa497cd5568f2c232ef19f6c085dcca1a971ce0.tar.gz craftbukkit-9fa497cd5568f2c232ef19f6c085dcca1a971ce0.tar.lz craftbukkit-9fa497cd5568f2c232ef19f6c085dcca1a971ce0.tar.xz craftbukkit-9fa497cd5568f2c232ef19f6c085dcca1a971ce0.zip |
Add implementation of the elder Guardian API
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java index f254e809..d25a2666 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(); + } + } } |