SPIGOT-7736: Creative spawn egg use loses components

This commit is contained in:
md_5 2024-06-10 14:06:36 +10:00
parent c6b4d5a87f
commit 3b6093b280
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -103,7 +103,7 @@
Item item = this.getItem();
- EnumInteractionResult enuminteractionresult = item.useOn(itemactioncontext);
+ // CraftBukkit start - handle all block place event logic here
+ DataComponentPatch oldData = this.getComponentsPatch();
+ DataComponentPatch oldData = this.components.asPatch();
+ int oldCount = this.getCount();
+ WorldServer world = (WorldServer) itemactioncontext.getLevel();
+
@ -120,7 +120,7 @@
+ } finally {
+ world.captureBlockStates = false;
+ }
+ DataComponentPatch newData = this.getComponentsPatch();
+ DataComponentPatch newData = this.components.asPatch();
+ int newCount = this.getCount();
+ this.setCount(oldCount);
+ this.restorePatch(oldData);