-
-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use arrow despawn rate for all projectiles
- Loading branch information
1 parent
3e61186
commit 80d7f35
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
patches/server/0132-Use-arrow-despawn-rate-for-all-projectiles.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |