mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
option to disable shulker box items from dropping contents when destroyed
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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 d9114ee2ef4f1dee7ae018f932a7804a61a90ef6..8b521ee48480d3eb5cc77051c425ff4552a86a09 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -296,7 +296,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 b20fdef329a9b1ef4a873502ed33f4769230f28b..4f93c8897180e7e3ad841d056799125c67d50752 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -171,6 +171,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 -> {
|
||||
@@ -215,6 +216,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;
|
||||
Reference in New Issue
Block a user