Allow negative exp pickup delay to pick up all orbs instantly

This commit is contained in:
BillyGalbreath
2022-01-10 10:20:24 -06:00
parent 6ffc1d7964
commit e0c84a4c8b

View File

@@ -3,6 +3,10 @@ From: BillyGalbreath <Blake.Galbreath@Gmail.com>
Date: Mon, 10 Jan 2022 10:04:31 -0600
Subject: [PATCH] Configurable player pickup exp delay
Default vanilla value is to delay 2 ticks between picking up exp orbs.
Players only pick up 1 orb at a time, so even with setting this to 0
players still only pick up one orb every tick. However, setting this
to any negative number will pick up all orbs instantly.
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 68072fae050fb83735725f3dc2525bfc9c0cc159..8515eddddb84b44afdbfeacc22bc1cd53fc06572 100644
@@ -17,6 +21,19 @@ index 68072fae050fb83735725f3dc2525bfc9c0cc159..8515eddddb84b44afdbfeacc22bc1cd5
player.take(this, 1);
int i = this.repairPlayerItems(player, this.value);
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 c8792fee068c13ae45f9eb936ef34fc5cae7ba57..e014859b52f31f29923dc4cf7cc0bf4a37b12fa3 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -620,7 +620,7 @@ public abstract class Player extends LivingEntity {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
- if (entity.getType() == EntityType.EXPERIENCE_ORB) {
+ if (entity.getType() == EntityType.EXPERIENCE_ORB && entity.level.purpurConfig.playerExpPickupDelay >= 0) { // Purpur
list1.add(entity);
} else if (!entity.isRemoved()) {
this.touch(entity);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 4bdd91dc2cd76525af4ba2f6d361e10efdf6fda3..15c023807a3f5ae3139294d28c5c672a4f111817 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java