Add ArmorStand Marker NBT API

This commit is contained in:
Zach Brown 2015-05-03 17:47:28 -05:00
parent d167eb42de
commit 9012499383
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From 6271c78a73f37bbbbacb527db1f4b772ebddae01 Mon Sep 17 00:00:00 2001
From: Anonymoose <MrAnonHimself@anon.life>
Date: Sun, 3 May 2015 17:44:20 -0500
Subject: [PATCH] Add ArmorStand Marker NBT API
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index b323e73..5b6623c 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -258,4 +258,20 @@ public interface ArmorStand extends LivingEntity {
* @param small whether this is scaled down
*/
void setSmall(boolean small);
+
+ /**
+ * Returns whether this armor stand has a small
+ * bounding box. This gets the NBT Marker tag
+ *
+ * @return whether the bounding box is small or not
+ */
+ boolean isSmallBoundingBox();
+
+ /**
+ * Sets whether this armor stand should have a small
+ * bounding box. This sets the NBT Marker tag
+ *
+ * @param small whether the bounding box is small or not
+ */
+ void setSmallBoundingBox(boolean small);
}
--
1.9.1

View File

@ -0,0 +1,52 @@
From e43a925b20358a827bb87a42544b4e9531b6d082 Mon Sep 17 00:00:00 2001
From: Anonymoose <MrAnonHimself@anon.life>
Date: Sun, 3 May 2015 17:44:20 -0500
Subject: [PATCH] Add ArmorStand Marker NBT API
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index ef1904b..e447aec 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -649,7 +649,7 @@ public class EntityArmorStand extends EntityLiving {
return (this.datawatcher.getByte(10) & 8) != 0;
}
- private void n(boolean flag) {
+ public void n(boolean flag) { // PaperSpigot - private -> public, setSmallBoundingBox (Marker) NBT
byte b0 = this.datawatcher.getByte(10);
if (flag) {
@@ -661,7 +661,7 @@ public class EntityArmorStand extends EntityLiving {
this.datawatcher.watch(10, Byte.valueOf(b0));
}
- public boolean s() {
+ public boolean s() { // PaperSpigot - isSmallBoundingBox
return (this.datawatcher.getByte(10) & 16) != 0;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 741b765..591c5a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -204,4 +204,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
(float) Math.toDegrees(old.getZ())
);
}
+
+ // PaperSpigot start - Implement bounding box (Marker) API
+ @Override
+ public boolean isSmallBoundingBox() {
+ return getHandle().s();
+ }
+
+ @Override
+ public void setSmallBoundingBox(boolean small) {
+ getHandle().n(small);
+ }
+ // PaperSpigot end
}
--
1.9.1