option to disable shulker box items from dropping contents when destroyed

This commit is contained in:
William Blake Galbreath
2025-01-12 11:38:38 -08:00
committed by granny
parent 19a65e8dcf
commit 137ef963b1
3 changed files with 10 additions and 39 deletions

View File

@@ -8,3 +8,11 @@
return customData.loadInto(blockEntity, level.registryAccess());
}
@@ -264,6 +_,7 @@
public void onDestroyed(ItemEntity itemEntity) {
ItemContainerContents itemContainerContents = itemEntity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY);
if (itemContainerContents != null) {
+ if (itemEntity.level().purpurConfig.shulkerBoxItemDropContentsWhenDestroyed && this.getBlock() instanceof ShulkerBoxBlock) // Purpur - option to disable shulker box items from dropping contents when destroyed
ItemUtils.onContainerDestroyed(itemEntity, itemContainerContents.nonEmptyItemsCopy());
}
}

View File

@@ -213,6 +213,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;