Arrow Despawn Rate

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2013-10-14 19:20:10 +11:00
parent 9e02bc055b
commit 29a8c7f4b3
2 changed files with 15 additions and 4 deletions

View File

@@ -49,7 +49,7 @@
+ // CraftBukkit start - handle the owner before the rest of things
+ this(type, x, y, z, world, stack, weapon, null);
+ }
+
+ protected AbstractArrow(EntityType<? extends AbstractArrow> entitytypes, double d0, double d1, double d2, Level world, ItemStack itemstack, @Nullable ItemStack itemstack1, @Nullable LivingEntity ownerEntity) {
+ this(entitytypes, world);
+ this.setOwner(ownerEntity);
@@ -57,7 +57,7 @@
+ this.pickupItemStack = itemstack.copy();
+ this.setCustomName((Component) itemstack.get(DataComponents.CUSTOM_NAME));
+ Unit unit = (Unit) itemstack.remove(DataComponents.INTANGIBLE_PROJECTILE);
+
if (unit != null) {
this.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
}
@@ -107,11 +107,13 @@
this.hasImpulse = true;
if (this.getPierceLevel() > 0 && projectiledeflection == ProjectileDeflection.NONE) {
@@ -357,7 +381,7 @@
@@ -356,8 +380,8 @@
protected void tickDespawn() {
++this.life;
if (this.life >= 1200) {
- if (this.life >= 1200) {
- this.discard();
+ if (this.life >= ((this instanceof ThrownTrident) ? this.level().spigotConfig.tridentDespawnRate : this.level().spigotConfig.arrowDespawnRate)) { // Spigot
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
}