mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
option to disable shulker box items from dropping contents when destroyed
This commit is contained in:
committed by
granny
parent
19a65e8dcf
commit
137ef963b1
@@ -1,39 +0,0 @@
|
|||||||
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/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
|
|
||||||
index ac5dc472337cd9613db5fc03f64763245129dfd9..f8928d5ac2f107a904ecc636e6bdeee7edd8da45 100644
|
|
||||||
--- a/net/minecraft/world/item/BlockItem.java
|
|
||||||
+++ b/net/minecraft/world/item/BlockItem.java
|
|
||||||
@@ -274,6 +274,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 f277d8b257bf66552bfbd0ce98af2aa1e93779b7..f62de466c50287ecbe364f74bd715cbdf02808ea 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
@@ -215,6 +215,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 -> {
|
|
||||||
@@ -262,6 +263,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;
|
|
||||||
@@ -8,3 +8,11 @@
|
|||||||
return customData.loadInto(blockEntity, level.registryAccess());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ public class PurpurWorldConfig {
|
|||||||
public int enderPearlCooldownCreative = 20;
|
public int enderPearlCooldownCreative = 20;
|
||||||
public float enderPearlEndermiteChance = 0.05F;
|
public float enderPearlEndermiteChance = 0.05F;
|
||||||
public int glowBerriesEatGlowDuration = 0;
|
public int glowBerriesEatGlowDuration = 0;
|
||||||
|
public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
|
||||||
private void itemSettings() {
|
private void itemSettings() {
|
||||||
itemImmuneToCactus.clear();
|
itemImmuneToCactus.clear();
|
||||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
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);
|
enderPearlCooldownCreative = getInt("gameplay-mechanics.item.ender-pearl.creative-cooldown", enderPearlCooldownCreative);
|
||||||
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||||
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
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;
|
public double minecartMaxSpeed = 0.4D;
|
||||||
|
|||||||
Reference in New Issue
Block a user