Purpur/patches/server/0047-Disable-loot-drops-on-death-by-cramming.patch
2022-08-05 15:30:11 -05:00

43 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Wed, 3 Jul 2019 23:58:31 -0500
Subject: [PATCH] Disable loot drops on death by cramming
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 9bb19e7a112c1411bb6b717de983c0359f6b0cb6..cb90fec7558923f547bab2d37ceffd67c07501ce 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1747,6 +1747,7 @@ public abstract class LivingEntity extends Entity {
this.dropEquipment(); // CraftBukkit - from below
if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ if (!(source == DamageSource.CRAMMING && level.purpurConfig.disableDropsOnCrammingDeath)) { // Purpur
this.dropFromLootTable(source, flag);
// Paper start
final boolean prev = this.clearEquipmentSlots;
@@ -1755,6 +1756,7 @@ public abstract class LivingEntity extends Entity {
// Paper end
this.dropCustomDeathLoot(source, i, flag);
this.clearEquipmentSlots = prev; // Paper
+ } // Purpur
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops, () -> {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 8e6bc5815e9624c6eb24e66cdba6d95989de4aae..ec5821991becc54f132b97806000759268558450 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -97,6 +97,11 @@ public class PurpurWorldConfig {
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
}
+ public boolean disableDropsOnCrammingDeath = false;
+ private void miscGameplayMechanicsSettings() {
+ disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
+ }
+
public double minecartMaxSpeed = 0.4D;
public boolean minecartPlaceAnywhere = false;
public boolean minecartControllable = false;