Files
Purpur/patches/server/0083-Add-player-death-exp-control-options.patch
William Blake Galbreath 193c511fce Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
a4f066cc Fix method profiler inbalance introduced in a2a9ffe (#3132)
c65dcad3 Don't delay chunk unloads during entity ticking
bc17ce69 Delay unsafe actions until after entity ticking is done - Fixes #3114
5553e6b3 Disable Sync Events firing Async errors during shutdown
e12c51d9 Use better variable for isStopping() API
586ee2bb Remove patch for MC-111480, fixed in 1.14
09a94215 Remove streams from Mob AI System
bb5c294e Fix Disabling Asynchronous Chunks
089d8356 Implement Chunk Priority / Urgency System for World Gen
fce69af7 Use dedicated thread for main thread blocking chunk loads
588b62e4 Add tick times API and /mspt command (#3102)
11de41c7 Add API MinecraftServer#isStopping (#3129)
942ff3c2 My patches are under MIT (#3130)
2020-04-12 03:45:54 -05:00

62 lines
3.4 KiB
Diff

From 420773360e59f43603f79cdb386308c08a56bd94 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 26 Dec 2019 22:08:37 -0600
Subject: [PATCH] Add player death exp control options
---
.../java/net/minecraft/server/EntityHuman.java | 15 ++++++++++++---
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 4 ++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 0e16e03bb1..477d5c00b4 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1862,9 +1862,18 @@ public abstract class EntityHuman extends EntityLiving {
@Override
protected int getExpValue(EntityHuman entityhuman) {
if (!this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY) && !this.isSpectator()) {
- int i = this.expLevel * 7;
-
- return i > 100 ? 100 : i;
+ // Purpur start
+ int toDrop;
+ try {
+ scriptEngine.eval("expLevel = " + expLevel);
+ scriptEngine.eval("expTotal = " + expTotal);
+ scriptEngine.eval("exp = " + exp);
+ toDrop = (int) Math.round((Double) scriptEngine.eval(world.purpurConfig.playerDeathExpDropEquation));
+ } catch (Exception ignore) {
+ toDrop = expLevel * 7;
+ }
+ return Math.min(toDrop, world.purpurConfig.playerDeathExpDropMax);
+ // Purpur end
} else {
return 0;
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 3cb3bcfe13..1fcdb4e28d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -155,6 +155,8 @@ public class PurpurWorldConfig {
public boolean disableDropsOnCrammingDeath = false;
public boolean fixClimbingBypassingCrammingRule = false;
public boolean milkCuresBadOmen = true;
+ public String playerDeathExpDropEquation = "expLevel * 7";
+ public int playerDeathExpDropMax = 100;
public boolean playerSleepOnlyWithCondition = false;
public String playerSleepCondition = "time >= 12541 && time <= 23458";
public boolean useBetterMending = false;
@@ -181,6 +183,8 @@ public class PurpurWorldConfig {
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
fixClimbingBypassingCrammingRule = getBoolean("gameplay-mechanics.fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
+ playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
+ playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
playerSleepOnlyWithCondition = getBoolean("gameplay-mechanics.player.sleep.only-with-condition", playerSleepOnlyWithCondition);
playerSleepCondition = getString("gameplay-mechanics.player.sleep.condition", playerSleepCondition);
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
--
2.24.0