mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
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)
This commit is contained in:
committed by
granny
parent
9630600d0c
commit
55dc415e72
@@ -1,37 +0,0 @@
|
||||
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/net/minecraft/world/entity/projectile/AbstractArrow.java b/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index f4513b1887f823b088dabe425be042b8fb2bde66..d2a8e0fb1e673cec5701fd184cedfd8e49212acd 100644
|
||||
--- a/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -372,7 +372,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
|
||||
}
|
||||
|
||||
public boolean isInGround() {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index fda9fcf681927334937d25706c9127fbbecd2ed5..2e807c72b8469210c4acdc591386368589913e61 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -102,6 +102,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;
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -347,7 +_,7 @@
|
||||
this.setInGround(false);
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
this.setDeltaMovement(deltaMovement.multiply(this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F));
|
||||
- this.life = 0;
|
||||
+ if (this.level().purpurConfig.arrowMovementResetsDespawnCounter) this.life = 0; // Purpur - Arrows should not reset despawn counter
|
||||
}
|
||||
|
||||
public boolean isInGround() { // Paper - protected -> public
|
||||
@@ -93,6 +93,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;
|
||||
|
||||
Reference in New Issue
Block a user