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 3253361d91e2a2e68d354eaf3dd3e3cd486e191d..a255b76cc1e6cb926585110e5f09ded37da7be20 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
@@ -260,6 +260,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 95b5106772a6701ecb0e60206871c139f215e487..6381828cc6cee1ec6c0a7951a36d22937dddf149 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;
|