mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes:0aa3cc7228Suppress deprecation registration warnings for brigadier events (#6297)81a7559b41Correct handling of invalid maps (#6302) Tuinity Changes:5620c57206Use Velocity compression and cipher natives (#351)3be4fc5809[CI-SKIP] Redirect to CI when clicking CI badge in README (#344)
55 lines
3.3 KiB
Diff
55 lines
3.3 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 d761865eabfc67651b0a2a92ad35fc236886b61d..3e04510519ca5d03eb16aab8b1094e24101cebf4 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1907,9 +1907,18 @@ public abstract class Player extends LivingEntity {
|
|
@Override
|
|
protected int getExperienceReward(Player player) {
|
|
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 {
|
|
+ scriptEngine.eval("expLevel = " + experienceLevel);
|
|
+ scriptEngine.eval("expTotal = " + totalExperience);
|
|
+ scriptEngine.eval("exp = " + experienceProgress);
|
|
+ toDrop = (int) Math.round((Double) scriptEngine.eval(level.purpurConfig.playerDeathExpDropEquation));
|
|
+ } catch (Exception ignore) {
|
|
+ toDrop = experienceLevel * 7;
|
|
+ }
|
|
+ return Math.min(toDrop, level.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 8e2d401e10c2fc7e748fd28073d94f09d228e445..d3aa93b934972758c50bd89ba951c5e2f54251a5 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -166,6 +166,8 @@ public class PurpurWorldConfig {
|
|
public boolean idleTimeoutUpdateTabList = false;
|
|
public int playerSpawnInvulnerableTicks = 60;
|
|
public boolean playerInvulnerableWhileAcceptingResourcePack = false;
|
|
+ public String playerDeathExpDropEquation = "expLevel * 7";
|
|
+ public int playerDeathExpDropMax = 100;
|
|
private void playerSettings() {
|
|
idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
|
|
idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
|
|
@@ -173,6 +175,8 @@ public class PurpurWorldConfig {
|
|
idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList);
|
|
playerSpawnInvulnerableTicks = getInt("gameplay-mechanics.player.spawn-invulnerable-ticks", playerSpawnInvulnerableTicks);
|
|
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
|
|
+ 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;
|