Skip to content

Commit 3f07f02

Browse files
authored
Make arrow despawn rate override configurable (#13409)
1 parent f7840d6 commit 3f07f02

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

paper-server/patches/sources/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java.patch

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
}
2727

2828
public void setSoundEvent(SoundEvent soundEvent) {
29-
@@ -207,6 +_,7 @@
29+
@@ -207,6 +_,10 @@
3030
this.setSharedFlagOnFire(this.getRemainingFireTicks() > 0);
3131
}
3232
} else {
33-
+ if (this.tickCount > 200) this.tickDespawn(); // Paper - tick life regardless after 10 seconds
33+
+ // Paper start - tick life regardless after X seconds
34+
+ final io.papermc.paper.configuration.type.number.IntOr.Disabled maxArrowDespawnInvulnerability = this.level().paperConfig().entities.spawning.maxArrowDespawnInvulnerability;
35+
+ if (maxArrowDespawnInvulnerability.enabled() && this.tickCount > maxArrowDespawnInvulnerability.intValue()) this.tickDespawn();
36+
+ // Paper end - tick life regardless after X seconds
3437
this.inGroundTime = 0;
3538
Vec3 vec31 = this.position();
3639
if (this.isInWater()) {

paper-server/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public class Sniffer extends ConfigurationPart {
171171
public class Spawning extends ConfigurationPart {
172172
public ArrowDespawnRate nonPlayerArrowDespawnRate = ArrowDespawnRate.def(WorldConfiguration.this.spigotConfig);
173173
public ArrowDespawnRate creativeArrowDespawnRate = ArrowDespawnRate.def(WorldConfiguration.this.spigotConfig);
174+
public IntOr.Disabled maxArrowDespawnInvulnerability = new IntOr.Disabled(OptionalInt.of(200));
174175
public boolean filterBadTileEntityNbtFromFallingBlocks = true;
175176
public List<NbtPathArgument.NbtPath> filteredEntityTagNbtPaths = NbtPathSerializer.fromString(List.of("Pos", "Motion", "sleeping_pos"));
176177
public boolean disableMobSpawnerSpawnEggTransformation = false;

0 commit comments

Comments
 (0)