Files
Purpur/patches/server/0102-Arrows-should-not-reset-despawn-counter.patch

38 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Wed, 4 Nov 2020 13:12:50 -0600
Subject: [PATCH] Arrows should not reset despawn counter
This prevents keeping arrows alive indefinitely (such as when the block
the arrow is stuck in gets removed, like a piston head going up/down)
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 5d6d26cfe8f0ab68a3145214b3fc126ca7a71a66..1ea5664e1e7dc73cbd2d1cc38c830a19ba985528 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -312,7 +312,7 @@ public abstract class AbstractArrow extends Projectile {
Vec3 vec3d = this.getDeltaMovement();
this.setDeltaMovement(vec3d.multiply((double) (this.random.nextFloat() * 0.2F), (double) (this.random.nextFloat() * 0.2F), (double) (this.random.nextFloat() * 0.2F)));
- this.life = 0;
+ if (this.level.purpurConfig.arrowMovementResetsDespawnCounter) this.life = 0; // Purpur - do not reset despawn counter
}
@Override
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index f607e8fc2bc998c93f86f01dbb556f960825489e..70911b0e8c47d505e43e11e5d29da150afb19272 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -103,6 +103,11 @@ public class PurpurWorldConfig {
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
}
+ public boolean arrowMovementResetsDespawnCounter = true;
+ private void arrowSettings() {
+ arrowMovementResetsDespawnCounter = getBoolean("gameplay-mechanics.arrow.movement-resets-despawn-counter", arrowMovementResetsDespawnCounter);
+ }
+
public boolean useBetterMending = false;
public boolean boatEjectPlayersOnLand = false;
public boolean disableDropsOnCrammingDeath = false;