Files
Purpur/patches/server/0185-option-to-disable-shulker-box-items-from-dropping-co.patch
granny ffeb49da1e ignore item_model component for don't run with scissors feature alongside custom_model_data component
by default, the "don't run with scissors" feature will not activate for shears that have an `item_model` component or `custom_model_data` component.

adds a new world config option at `gameplay-mechanics.item.shears.damage-if-sprinting-item-model` that allows specifying a custom item model ResourceLocation (`purpurmc:scissors` by default) for use with this feature.
2024-12-06 06:05:14 -08:00

40 lines
2.5 KiB
Diff

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/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index ac5dc472337cd9613db5fc03f64763245129dfd9..f8928d5ac2f107a904ecc636e6bdeee7edd8da45 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/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 6cb8722c1ca2c182ed24d8e7770025560898c9e1..294153e02ea584ab5a8fc8209dc87660bddc27a7 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;