Files
KaiijuMC/patches/server/0010-Shulker-drop-contents-when-destroyed.patch
2023-06-21 17:49:21 +02:00

37 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xymb <xymb@endcrystal.me>
Date: Sat, 8 Apr 2023 23:38:13 +0300
Subject: [PATCH] Shulker drop contents when destroyed
Don't drop shulker contents when shulker items are destroyed (by cactus,
lava..)
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index 05f9c01131e78927d88f1170c3eda4adf25ac8ba..55dcbb48450b24f80e0a04bedeb54f64e94ebb9e 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -144,7 +144,10 @@ public class KaiijuWorldConfig {
}
}
+ public boolean shulkerBoxDropContentsWhenDestroyed = true;
+
private void optimizationSettings() {
+ shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
}
private void gameplaySettings() {
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index ebee8de2ed831755b6fd154f6cc77ac993839bb9..ce5faefe3b67087509833800f0472f14131f2011 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -288,7 +288,7 @@ public class BlockItem extends Item {
@Override
public void onDestroyed(ItemEntity entity) {
- if (this.block instanceof ShulkerBoxBlock) {
+ if (this.block instanceof ShulkerBoxBlock && entity.level().kaiijuConfig.shulkerBoxDropContentsWhenDestroyed) { // Kaiiju
ItemStack itemstack = entity.getItem();
CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);