mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Use arrow despawn rate for all projectiles
This commit is contained in:
@@ -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() {
|
||||
Reference in New Issue
Block a user