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 Paper Changes: PaperMC/Paper@c4782f5 Add xp orb spawn reason for frogs (#8045) PaperMC/Paper@95ac874 Add ZombieVillager conversion without entity event (#8111) PaperMC/Paper@41238a4 [ci skip] Fixed typo in README (#8031)
59 lines
4.1 KiB
Diff
59 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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 cbeea12009ec89fb3223e6a9545485a9bc19c21f..b10c792a4f743bdb8a10fe1693def562d161a879 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
@@ -303,8 +303,8 @@ public class ExperienceOrb extends Entity {
|
|
@Override
|
|
public void playerTouch(Player player) {
|
|
if (!this.level.isClientSide) {
|
|
- if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
|
- player.takeXpDelay = 2;
|
|
+ if (player.takeXpDelay <= 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
|
+ player.takeXpDelay = this.level.purpurConfig.playerExpPickupDelay; // Purpur
|
|
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 870e794392b94d140db6d5650c3e7ae3dd6f593d..7344324517fb10ee6ab3467b40fcb9cd798961cb 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -630,7 +630,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 62c2bd8988815b5afe54a26e328bf75a758ffab4..ce6744240e4e57aef9f5d452047f103068e37b91 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -416,6 +416,7 @@ public class PurpurWorldConfig {
|
|
public boolean playerRidableInWater = false;
|
|
public boolean playerRemoveBindingWithWeakness = false;
|
|
public int shiftRightClickRepairsMendingPoints = 0;
|
|
+ public int playerExpPickupDelay = 2;
|
|
private void playerSettings() {
|
|
if (PurpurConfig.version < 19) {
|
|
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
|
@@ -444,6 +445,7 @@ public class PurpurWorldConfig {
|
|
playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater);
|
|
playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness);
|
|
shiftRightClickRepairsMendingPoints = getInt("gameplay-mechanics.player.shift-right-click-repairs-mending-points", shiftRightClickRepairsMendingPoints);
|
|
+ playerExpPickupDelay = getInt("gameplay-mechanics.player.exp-pickup-delay-ticks", playerExpPickupDelay);
|
|
}
|
|
|
|
private static boolean projectileDespawnRateSettingsMigrated = false;
|