From 1d3be17a608498f26ee1ba240b76280b051104ec Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 11 Jan 2024 12:41:50 -0800 Subject: [PATCH] Add BlockStateMeta#clearBlockState --- .../bukkit/craftbukkit/inventory/CraftMetaBlockState.java | 7 +++++++ .../org/bukkit/craftbukkit/inventory/CraftMetaShield.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java index e70b917698..3985e5b4e2 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java @@ -239,6 +239,13 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta return this.blockEntityTag != null; } + // Paper start - add method to clear block state + @Override + public void clearBlockState() { + this.blockEntityTag = null; + } + // Paper end - add method to clear block state + @Override public BlockState getBlockState() { return (this.blockEntityTag != null) ? this.blockEntityTag.copy() : CraftMetaBlockState.getBlockState(this.material, null); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java index 3542c6e72f..c8eec04685 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java @@ -257,6 +257,13 @@ public class CraftMetaShield extends CraftMetaItem implements ShieldMeta, BlockS this.banner = (Banner) blockState; } + // Paper start - add method to clear block state + @Override + public void clearBlockState() { + this.banner = null; + } + // Paper end - add method to clear block state + private static Banner getBlockState(DyeColor color) { BlockPos pos = BlockPos.ZERO; Material stateMaterial = CraftMetaShield.shieldToBannerHack(color);