mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: ad708dd3 Add option to allow iron golems to spawn in air (Closes #1965, Closes #1851) b16fd5c3 Updated Upstream (Bukkit/CraftBukkit/Spigot)
62 lines
3.4 KiB
Diff
62 lines
3.4 KiB
Diff
From a0a239fdc10a05d943ae1ecad8ff4fe25a2fa720 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 36582a80af..d7e00b06b8 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 02626283b3..ff8c60000d 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -164,6 +164,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;
|
|
@@ -190,6 +192,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
|
|
|