From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath 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 6c261b9ddee80139140bd1f091fcdacc3a70c8ef..65917d1438b0f480385e9117ba2a386e990b9a0b 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java @@ -300,7 +300,7 @@ public class BlockItem extends Item { @Override public void onDestroyed(ItemEntity entity) { - if (this.block instanceof ShulkerBoxBlock) { + if (this.block instanceof ShulkerBoxBlock && entity.level.purpurConfig.shulkerBoxItemDropContentsWhenDestroyed) { CompoundTag nbttagcompound = entity.getItem().getTag(); if (nbttagcompound != null) { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 692cfd153391dad3780eb79f9f25c069f365dd95..0a0ea959bfe246197ed7a0bb353ed0749588e143 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -175,6 +175,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 -> { @@ -219,6 +220,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;