mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
40 lines
2.5 KiB
Diff
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 b5b7f1db21a22f16f06ced775c8173f90e36a91c..33d9b5fb6897fefb0f7b9009df7339341cb42317 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
@@ -249,6 +249,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 ff9bb8f21d6da7f8d3b0a726098227d95e6e3207..277c1be1ede46b50f865a2c1d1b38ab22cae9ef9 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -214,6 +214,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 -> {
|
|
@@ -260,6 +261,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;
|