option to disable shulker box items from dropping contents when destroyed

This commit is contained in:
William Blake Galbreath
2025-01-12 11:38:38 -08:00
committed by granny
parent 19a65e8dcf
commit 137ef963b1
3 changed files with 10 additions and 39 deletions

View File

@@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Mon, 5 Jul 2021 20:23:08 -0500
Subject: [PATCH] option to disable shulker box items from dropping contents
when destroyed
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
index ac5dc472337cd9613db5fc03f64763245129dfd9..f8928d5ac2f107a904ecc636e6bdeee7edd8da45 100644
--- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java
@@ -274,6 +274,7 @@ public class BlockItem extends Item {
ItemContainerContents itemcontainercontents = (ItemContainerContents) entity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY);
if (itemcontainercontents != null) {
+ if (entity.level().purpurConfig.shulkerBoxItemDropContentsWhenDestroyed && this.getBlock() instanceof ShulkerBoxBlock) // Purpur
ItemUtils.onContainerDestroyed(entity, itemcontainercontents.nonEmptyItemsCopy());
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index f277d8b257bf66552bfbd0ce98af2aa1e93779b7..f62de466c50287ecbe364f74bd715cbdf02808ea 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -215,6 +215,7 @@ public class PurpurWorldConfig {
public int enderPearlCooldownCreative = 20;
public float enderPearlEndermiteChance = 0.05F;
public int glowBerriesEatGlowDuration = 0;
+ public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
private void itemSettings() {
itemImmuneToCactus.clear();
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
@@ -262,6 +263,7 @@ public class PurpurWorldConfig {
enderPearlCooldownCreative = getInt("gameplay-mechanics.item.ender-pearl.creative-cooldown", enderPearlCooldownCreative);
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
+ shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
}
public double minecartMaxSpeed = 0.4D;