mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Pufferfish Changes: pufferfish-gg/Pufferfish@c9f4e20 Final 1.20.4 Update pufferfish-gg/Pufferfish@1f3ad02 Final 1.20.4 update, for realzies pufferfish-gg/Pufferfish@b1ab664 Enable SIMD on java 21 pufferfish-gg/Pufferfish@0674c2b 1.21 compiles pufferfish-gg/Pufferfish@98ea973 Fix 1.21 version checkers pufferfish-gg/Pufferfish@68f859c Fix lambda/tick guard patch pufferfish-gg/Pufferfish@eaa18d5 Updated Upstream (Paper) pufferfish-gg/Pufferfish@1d72eea Updated Upstream (Paper) pufferfish-gg/Pufferfish@1d3c743 Update pufferfish version detector stuff pufferfish-gg/Pufferfish@5e30963 Fix crash bug pufferfish-gg/Pufferfish@12571eb Use mojmapped paperclip jar instead (CI only) pufferfish-gg/Pufferfish@4d16ae0 Drop a patch - moonrise includes it pufferfish-gg/Pufferfish@52c2d05 Revert "Drop a patch - moonrise includes it" pufferfish-gg/Pufferfish@bdb56f1 Fix entity interactions with fluids pufferfish-gg/Pufferfish@469e5c1 Updated Upstream (Paper) pufferfish-gg/Pufferfish@d75961f 1.21.1 Update (Updated Upstream (Paper))
56 lines
3.2 KiB
Diff
56 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 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
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index 5e404e470a28f04f5659503bcc6b66caf1880f3f..9dd8dc8f0dc218c5a021d84649f364cd2f1b3a45 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1976,9 +1976,19 @@ public abstract class Player extends LivingEntity {
|
|
@Override
|
|
protected int getBaseExperienceReward() {
|
|
if (!this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) {
|
|
- int i = this.experienceLevel * 7;
|
|
-
|
|
- return i > 100 ? 100 : i;
|
|
+ // Purpur start
|
|
+ int toDrop;
|
|
+ try {
|
|
+ toDrop = Math.round(((Number) scriptEngine.eval("let expLevel = " + experienceLevel + "; " +
|
|
+ "let expTotal = " + totalExperience + "; " +
|
|
+ "let exp = " + experienceProgress + "; " +
|
|
+ level().purpurConfig.playerDeathExpDropEquation)).floatValue());
|
|
+ } catch (javax.script.ScriptException e) {
|
|
+ e.printStackTrace();
|
|
+ toDrop = experienceLevel * 7;
|
|
+ }
|
|
+ return Math.min(toDrop, level().purpurConfig.playerDeathExpDropMax);
|
|
+ // Purpur end
|
|
} else {
|
|
return 0;
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index cde1b1277d83ac2478f872dccdc2f7f87196cc94..ed8f3c606984f83b77ca96cbfc8bcd454ad63ff8 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -172,6 +172,8 @@ public class PurpurWorldConfig {
|
|
public boolean idleTimeoutCountAsSleeping = false;
|
|
public boolean idleTimeoutUpdateTabList = false;
|
|
public boolean idleTimeoutTargetPlayer = true;
|
|
+ public String playerDeathExpDropEquation = "expLevel * 7";
|
|
+ public int playerDeathExpDropMax = 100;
|
|
private void playerSettings() {
|
|
if (PurpurConfig.version < 19) {
|
|
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
|
@@ -183,6 +185,8 @@ public class PurpurWorldConfig {
|
|
idleTimeoutCountAsSleeping = getBoolean("gameplay-mechanics.player.idle-timeout.count-as-sleeping", idleTimeoutCountAsSleeping);
|
|
idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList);
|
|
idleTimeoutTargetPlayer = getBoolean("gameplay-mechanics.player.idle-timeout.mobs-target", idleTimeoutTargetPlayer);
|
|
+ playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
|
|
+ playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
|
|
}
|
|
|
|
public boolean silkTouchEnabled = false;
|