mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Merge in Tuinity patches
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
From b6323fd72ac5f115e111a57e0cb5ac9344d751d3 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 36582a80a..d7e00b06b 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 2dfbae959..a229c1a2e 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
|
||||
|
||||
Reference in New Issue
Block a user