From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MartijnMuijsers Date: Tue, 29 Nov 2022 21:37:22 +0100 Subject: [PATCH] Make arrow movement resetting despawn counter configurable License: MIT (https://opensource.org/licenses/MIT) This patch is based on the following patch: "Arrows should not reset despawn counter" By: William Blake Galbreath As part of: Purpur (https://github.com/PurpurMC/Purpur) Licensed under: MIT (https://opensource.org/licenses/MIT) * Purpur description * 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 def3b3f8dac4b28eaaafdd9bc2e7f4b9ec9d6855..ca28f41a5a0405adf07cc2898d53a77f5c7b3e8c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -322,7 +322,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.galeConfig().gameplayMechanics.arrowMovementResetsDespawnCounter) this.life = 0; // Gale - Purpur - make arrow movement resetting despawn counter configurable } @Override diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java index 3b023cbd132c6aa263dbbe54ed7d30e1049d3875..345ce3a53e3e7ee5a4dd9a632231edfe161cd821 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java @@ -244,6 +244,8 @@ public class GaleWorldConfiguration extends ConfigurationPart { public GameplayMechanics gameplayMechanics; public class GameplayMechanics extends ConfigurationPart { + public boolean arrowMovementResetsDespawnCounter = true; // Gale - Purpur - make arrow movement resetting despawn counter configurable + public Fixes fixes; public class Fixes extends ConfigurationPart {