From 83f25730bd76bf1c07d86dee48f375e9c49eb3e8 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 26 Jun 2020 10:58:17 +1000 Subject: [PATCH] #687: Add visibility and fixed API for ItemFrames By: SydMontague --- .../nms-patches/EntityItemFrame.patch | 9 +++++++++ .../craftbukkit/entity/CraftItemFrame.java | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/paper-server/nms-patches/EntityItemFrame.patch b/paper-server/nms-patches/EntityItemFrame.patch index 13cff21e36..3c5c54278c 100644 --- a/paper-server/nms-patches/EntityItemFrame.patch +++ b/paper-server/nms-patches/EntityItemFrame.patch @@ -1,5 +1,14 @@ --- a/net/minecraft/server/EntityItemFrame.java +++ b/net/minecraft/server/EntityItemFrame.java +@@ -11,7 +11,7 @@ + private static final DataWatcherObject ITEM = DataWatcher.a(EntityItemFrame.class, DataWatcherRegistry.g); + private static final DataWatcherObject g = DataWatcher.a(EntityItemFrame.class, DataWatcherRegistry.b); + private float an = 1.0F; +- private boolean ao; ++ public boolean ao; // PAIL private -> public // PAIL rename isFixed + + public EntityItemFrame(EntityTypes entitytypes, World world) { + super(entitytypes, world); @@ -53,16 +53,27 @@ @Override protected void updateBoundingBox() { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index 2873ff9d1f..79d443abb7 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -128,6 +128,26 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { } } + @Override + public boolean isVisible() { + return !getHandle().isInvisible(); + } + + @Override + public void setVisible(boolean visible) { + getHandle().setInvisible(!visible); + } + + @Override + public boolean isFixed() { + return getHandle().ao; + } + + @Override + public void setFixed(boolean fixed) { + getHandle().ao = fixed; + } + @Override public EntityItemFrame getHandle() { return (EntityItemFrame) entity;