aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0379-Add-BlockStateMeta-clearBlockState.patch
blob: ecafb80ec5a5c6683684600f1366ec3a182b6cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 11 Jan 2024 12:41:50 -0800
Subject: [PATCH] Add BlockStateMeta#clearBlockState


diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
index 301d883a7626e3abd222517400367fc40d6fa2bd..23dbc56edf0d16cf07ced2899942abae28397694 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
@@ -198,6 +198,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/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java
index 3542c6e72f5ff459d50b73fa210ea835f52dfa49..2ad744875fea490eb8aa3883e4567ec1824c811a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java
@@ -7,8 +7,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import net.minecraft.core.BlockPos;
+import net.minecraft.core.component.DataComponentMap;
 import net.minecraft.core.component.DataComponentPatch;
 import net.minecraft.core.component.DataComponents;
+import net.minecraft.world.item.component.CustomData;
 import net.minecraft.world.level.block.entity.BannerPatternLayers;
 import org.bukkit.DyeColor;
 import org.bukkit.Material;
@@ -298,4 +300,11 @@ public class CraftMetaShield extends CraftMetaItem implements ShieldMeta, BlockS
             default -> throw new IllegalArgumentException("Unknown banner colour");
         };
     }
+
+    // Paper start - add method to clear block state
+    @Override
+    public void clearBlockState() {
+        this.banner = null;
+    }
+    // Paper end - add method to clear block state
 }