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 96fb69ec6db2e7c8c728435f0c537b076259b2fb..f713734efaad4312be270d808e79f0e562c84466 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java @@ -28,6 +28,7 @@ import net.minecraft.world.level.block.ShulkerBoxBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.shapes.CollisionContext; @@ -256,6 +257,7 @@ public class BlockItem extends Item { @Override public void onDestroyed(ItemEntity entity) { + //entity.level().purpurConfig.shulkerBoxItemDropContentsWhenDestroyed // Purpur - TODO: shulkerBoxItemDropContentsWhenDestroyed ItemContainerContents itemcontainercontents = (ItemContainerContents) entity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY); if (itemcontainercontents != null) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index 2335a56bb46fd9ece82547544e8cac883562eba2..6be3b83976cfd92f984f2ce9479d6f0f5d883e17 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -221,6 +221,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 -> { @@ -267,6 +268,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;