mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
remove LivingEntity#safeFallDistance API
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
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 d5383e9cbbee2f9d4223319ae38abed41a13cfb3..a838f339dd0085660164b0eb1597e0a14e4de6f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1962,9 +1962,19 @@ public abstract class Player extends LivingEntity {
|
||||
@Override
|
||||
public int getExperienceReward() {
|
||||
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 917cbc020f8c6d25df6d809c6fea0242d424f2e9..9efb2bf7614f160fd9871dcfbe764c5c5913c728 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -171,6 +171,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);
|
||||
@@ -182,6 +184,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 farmlandGetsMoistFromBelow = false;
|
||||
Reference in New Issue
Block a user