From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Mon, 17 Aug 2020 23:26:43 -0500 Subject: [PATCH] Use arrow despawn rate for all projectiles diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index b0218959a..1587a5aa7 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -23,7 +23,7 @@ public abstract class EntityArrow extends IProjectile { protected int c; public EntityArrow.PickupStatus fromPlayer; public int shake; - public int despawnCounter; + //public int despawnCounter; // Purpur - moved to IProjectile private double damage; public int knockbackStrength; private SoundEffect ak; diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java index 9a17eb606..9a41428ea 100644 --- a/src/main/java/net/minecraft/server/IProjectile.java +++ b/src/main/java/net/minecraft/server/IProjectile.java @@ -13,6 +13,7 @@ public abstract class IProjectile extends Entity { private UUID shooter; private int c; private boolean d; public boolean leftOwner() { return d; } public void setLeftOwner(boolean leftOwner) { this.d = leftOwner; } // Purpur - OBFHELPER + public int despawnCounter; // Purpur - moved from EntityArrow IProjectile(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -79,7 +80,22 @@ public abstract class IProjectile extends Entity { } super.tick(); + + // Purpur start + if (!(this instanceof EntityArrow)) { + if (ticksLived > 200) this.tickDespawnCounter(); // Paper - tick despawnCounter regardless after 10 seconds + } + // Purpur end + } + + // Purpur start - copied from EntityArrow + protected void tickDespawnCounter() { + ++this.despawnCounter; + if (this.despawnCounter >= world.spigotConfig.arrowDespawnRate) { + this.die(); + } } + // Purpur end public boolean checkIfLeftOwner() { return this.h(); } // Purpur - OBFHELPER private boolean h() {