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

Paper Changes:
cb15cfa4 Improve Async Login so pending connections dont get exposed
f275e9cb Optimize Hoppers - Major Boost - Got2GoFast!
0106485c Improvements to watchdog changes
65934b1f Fix build for last commit. 5am commits are great
3f436029 Don't process watchdog until server has fully started and ticked.
938bd972 Don't fire BlockFade on worldgen threads - Fixes #3208
509a828e Fix loading spawn chunks when async chunks is off
8a91bfd2 Improvements to async login
bf698865 Revert "Re-track players that dismount from other players"
82b98418 Fix some issues with async login as well another source of sync loads
aa241d2b Allow multiple callbacks to schedule for Callback Executor
a2064a41 Add PlayerAttackEntityCooldownResetEvent This event is called when processing a player's attack on an entity right before their attack strength cd is reset, there are no existing events that fire within this period of time so it was impossible to capture the players attack strength via API prior to this commit.
f48d4299 Allow sleeping players to float
eeb2f67d Fix Bed respawn deviating too far from vanilla (#3195)
68a7b9fe Move player to spawn point if spawn in unloaded world
2020-04-24 08:22:02 -05:00

62 lines
3.4 KiB
Diff

From 78d2895b762b6a40bb6f1a23ff62f699155aa69c 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 ed0a559f..8c6556fe 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1866,9 +1866,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 3cb3bcfe..1fcdb4e2 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