Skip to content

Commit

Permalink
Use arrow despawn rate for all projectiles
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Aug 18, 2020
1 parent 3e61186 commit 80d7f35
Showing 1 changed file with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
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 b0218959a0..1587a5aa77 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 6c52af04a7..2522cfc9cd 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<? extends IProjectile> 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() {

0 comments on commit 80d7f35

Please sign in to comment.