Remaining projectile classes
This commit is contained in:
4 files changed
+31
-90
No files matched your search
-24
@@ -1,24 +0,0 @@
|
||||
From 3aeeaf31b7a7f888f54e47826e8ec0ddbe65c4bf Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 14:37:42 +0100
|
||||
Subject: [PATCH] paper File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/Fireball.java b/net/minecraft/world/entity/projectile/Fireball.java
|
||||
index 99aa3b854db13b4d9404b519d5e2d61a2b004b20..66dcd3c43bab5f18f8a3a891df2ff0612d5b6e6b 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Fireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Fireball.java
|
||||
@@ -60,7 +60,12 @@ public abstract class Fireball extends AbstractHurtingProjectile implements Item
|
||||
public void readAdditionalSaveData(CompoundTag compound) {
|
||||
super.readAdditionalSaveData(compound);
|
||||
if (compound.contains("Item", 10)) {
|
||||
- this.setItem(ItemStack.parse(this.registryAccess(), compound.getCompound("Item")).orElse(this.getDefaultItem()));
|
||||
+ // CraftBukkit start - SPIGOT-5474 probably came from bugged earlier versions
|
||||
+ final ItemStack itemStack = ItemStack.parse(this.registryAccess(), compound.getCompound("Item")).orElse(this.getDefaultItem());
|
||||
+ if (!itemStack.isEmpty()) {
|
||||
+ this.setItem(itemStack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.setItem(this.getDefaultItem());
|
||||
}
|
||||
+3
-25
@@ -1,14 +1,6 @@
|
||||
From 3aeeaf31b7a7f888f54e47826e8ec0ddbe65c4bf Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 14:37:42 +0100
|
||||
Subject: [PATCH] paper File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/EyeOfEnder.java b/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
index 6dfba63a13bb56f61c2768a16c5ceadfe1b81aad..01a9bad80a30a7879a69b800258b616b4d986108 100644
|
||||
--- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
@@ -70,6 +70,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@@ -73,6 +_,11 @@
|
||||
}
|
||||
|
||||
public void signalTo(BlockPos pos) {
|
||||
@@ -20,7 +12,7 @@ index 6dfba63a13bb56f61c2768a16c5ceadfe1b81aad..01a9bad80a30a7879a69b800258b616b
|
||||
double d = pos.getX();
|
||||
int y = pos.getY();
|
||||
double d1 = pos.getZ();
|
||||
@@ -86,8 +91,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@@ -89,8 +_,10 @@
|
||||
this.tz = d1;
|
||||
}
|
||||
|
||||
@@ -31,7 +23,7 @@ index 6dfba63a13bb56f61c2768a16c5ceadfe1b81aad..01a9bad80a30a7879a69b800258b616b
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,7 +168,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@@ -164,7 +_,7 @@
|
||||
this.life++;
|
||||
if (this.life > 80 && !this.level().isClientSide) {
|
||||
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
|
||||
@@ -40,17 +32,3 @@ index 6dfba63a13bb56f61c2768a16c5ceadfe1b81aad..01a9bad80a30a7879a69b800258b616b
|
||||
if (this.surviveAfterDeath) {
|
||||
this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
|
||||
} else {
|
||||
@@ -181,7 +188,12 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag compound) {
|
||||
if (compound.contains("Item", 10)) {
|
||||
- this.setItem(ItemStack.parse(this.registryAccess(), compound.getCompound("Item")).orElse(this.getDefaultItem()));
|
||||
+ // CraftBukkit start - SPIGOT-6103 summon, see also SPIGOT-5474
|
||||
+ ItemStack itemStack = ItemStack.parse(this.registryAccess(), compound.getCompound("Item")).orElse(this.getDefaultItem());
|
||||
+ if (!itemStack.isEmpty()) {
|
||||
+ this.setItem(itemStack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.setItem(this.getDefaultItem());
|
||||
}
|
||||
+3
-11
@@ -1,14 +1,6 @@
|
||||
From 3aeeaf31b7a7f888f54e47826e8ec0ddbe65c4bf Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 14:37:42 +0100
|
||||
Subject: [PATCH] paper File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/LlamaSpit.java b/net/minecraft/world/entity/projectile/LlamaSpit.java
|
||||
index aed44116a1bde9fe7a37d3768c8bad3768d22e43..4880db97135d54fa72f64c108b2bd4ded096438b 100644
|
||||
--- a/net/minecraft/world/entity/projectile/LlamaSpit.java
|
||||
+++ b/net/minecraft/world/entity/projectile/LlamaSpit.java
|
||||
@@ -43,16 +43,16 @@ public class LlamaSpit extends Projectile {
|
||||
@@ -43,16 +_,16 @@
|
||||
super.tick();
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
HitResult hitResultOnMoveVector = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
@@ -22,13 +14,13 @@ index aed44116a1bde9fe7a37d3768c8bad3768d22e43..4880db97135d54fa72f64c108b2bd4de
|
||||
if (this.level().getBlockStates(this.getBoundingBox()).noneMatch(BlockBehaviour.BlockStateBase::isAir)) {
|
||||
- this.discard();
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
} else if (this.isInWaterOrBubble()) {
|
||||
} else if (this.isInWater()) {
|
||||
- this.discard();
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
this.setDeltaMovement(deltaMovement.scale(0.99F));
|
||||
this.applyGravity();
|
||||
@@ -76,7 +76,7 @@ public class LlamaSpit extends Projectile {
|
||||
@@ -76,7 +_,7 @@
|
||||
protected void onHitBlock(BlockHitResult result) {
|
||||
super.onHitBlock(result);
|
||||
if (!this.level().isClientSide) {
|
||||
+25
-30
@@ -1,25 +1,18 @@
|
||||
From 3aeeaf31b7a7f888f54e47826e8ec0ddbe65c4bf Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 14:37:42 +0100
|
||||
Subject: [PATCH] paper File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8ba7a29001 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -43,6 +43,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
public boolean hasBeenShot;
|
||||
@@ -47,6 +_,7 @@
|
||||
public boolean hasBeenShot = false;
|
||||
@Nullable
|
||||
private Entity lastDeflectedBy;
|
||||
+ protected boolean hitCancelled = false; // CraftBukkit
|
||||
|
||||
Projectile(EntityType<? extends Projectile> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -53,15 +54,36 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -57,15 +_,36 @@
|
||||
this.ownerUUID = owner.getUUID();
|
||||
this.cachedOwner = owner;
|
||||
}
|
||||
- }
|
||||
+ // Paper start - Refresh ProjectileSource for projectiles
|
||||
+ else {
|
||||
+ this.ownerUUID = null;
|
||||
@@ -38,7 +31,7 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
+ if (this.cachedOwner != null && !this.cachedOwner.isRemoved() && this.projectileSource == null && this.cachedOwner.getBukkitEntity() instanceof org.bukkit.projectiles.ProjectileSource projSource) {
|
||||
+ this.projectileSource = projSource;
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // Paper end - Refresh ProjectileSource for projectiles
|
||||
|
||||
@Nullable
|
||||
@@ -53,15 +46,15 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
return this.cachedOwner;
|
||||
} else {
|
||||
return null;
|
||||
@@ -98,6 +120,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -98,6 +_,7 @@
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag compound) {
|
||||
if (compound.hasUUID("Owner")) {
|
||||
this.setOwnerThroughUUID(compound.getUUID("Owner"));
|
||||
+ if (this instanceof ThrownEnderpearl && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && this.level().paperConfig().misc.legacyEnderPearlBehavior) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit
|
||||
}
|
||||
|
||||
this.leftOwner = compound.getBoolean("LeftOwner");
|
||||
@@ -175,13 +198,25 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
this.setOwnerThroughUUID(compound.read("Owner", UUIDUtil.CODEC).orElse(null));
|
||||
+ if (this instanceof ThrownEnderpearl && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && this.level().paperConfig().misc.legacyEnderPearlBehavior) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit
|
||||
this.leftOwner = compound.getBooleanOr("LeftOwner", false);
|
||||
this.hasBeenShot = compound.getBooleanOr("HasBeenShot", false);
|
||||
}
|
||||
@@ -173,7 +_,14 @@
|
||||
float f2 = Mth.cos(y * (float) (Math.PI / 180.0)) * Mth.cos(x * (float) (Math.PI / 180.0));
|
||||
this.shoot(f, f1, f2, velocity, inaccuracy);
|
||||
Vec3 knownMovement = shooter.getKnownMovement();
|
||||
@@ -75,6 +68,8 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
+ // Paper end - allow disabling relative velocity
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,7 +_,12 @@
|
||||
public static <T extends Projectile> T spawnProjectileFromRotation(
|
||||
Projectile.ProjectileFactory<T> factory, ServerLevel level, ItemStack spawnedFrom, LivingEntity owner, float z, float velocity, float innaccuracy
|
||||
) {
|
||||
@@ -88,7 +83,7 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
factory.create(level, owner, spawnedFrom),
|
||||
level,
|
||||
spawnedFrom,
|
||||
@@ -206,7 +241,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -218,7 +_,12 @@
|
||||
public static <T extends Projectile> T spawnProjectileUsingShoot(
|
||||
T projectile, ServerLevel level, ItemStack spawnedFrom, double x, double y, double z, float velocity, float inaccuracy
|
||||
) {
|
||||
@@ -102,7 +97,7 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
}
|
||||
|
||||
public static <T extends Projectile> T spawnProjectile(T projectile, ServerLevel level, ItemStack spawnedFrom) {
|
||||
@@ -214,12 +254,46 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -226,11 +_,45 @@
|
||||
}
|
||||
|
||||
public static <T extends Projectile> T spawnProjectile(T projectile, ServerLevel level, ItemStack stack, Consumer<T> adapter) {
|
||||
@@ -115,9 +110,10 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
- level.addFreshEntity(projectile);
|
||||
- projectile.applyOnProjectileSpawned(level, stack);
|
||||
- return projectile;
|
||||
- }
|
||||
+ return new Delayed<>(projectile, level, stack); // Paper - delayed projectile spawning
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - delayed projectile spawning
|
||||
+ public record Delayed<T extends Projectile>(
|
||||
+ T projectile,
|
||||
@@ -148,11 +144,10 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - delayed projectile spawning
|
||||
+
|
||||
|
||||
public void applyOnProjectileSpawned(ServerLevel level, ItemStack spawnedFrom) {
|
||||
EnchantmentHelper.onProjectileSpawned(level, spawnedFrom, this, item -> {});
|
||||
if (this instanceof AbstractArrow abstractArrow) {
|
||||
@@ -230,6 +304,17 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -242,6 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +165,7 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) {
|
||||
if (hitResult.getType() == HitResult.Type.ENTITY) {
|
||||
EntityHitResult entityHitResult = (EntityHitResult)hitResult;
|
||||
@@ -261,7 +346,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -273,7 +_,13 @@
|
||||
public boolean deflect(ProjectileDeflection deflection, @Nullable Entity entity, @Nullable Entity owner, boolean deflectedByPlayer) {
|
||||
deflection.deflect(this, entity, this.random);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -185,7 +180,7 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
this.onDeflection(entity, deflectedByPlayer);
|
||||
}
|
||||
|
||||
@@ -297,15 +388,35 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -309,15 +_,35 @@
|
||||
}
|
||||
|
||||
protected void onHitBlock(BlockHitResult result) {
|
||||
@@ -221,7 +216,7 @@ index 99a6576fceded89806137aab2412588f8df6b834..ad0bb896d6ea669ce88bfe6490319e8b
|
||||
return owner == null || this.leftOwner || !owner.isPassengerOfSameVehicle(target);
|
||||
}
|
||||
}
|
||||
@@ -318,13 +429,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -330,13 +_,7 @@
|
||||
}
|
||||
|
||||
protected static float lerpRotation(float currentRotation, float targetRotation) {
|
||||
Reference in new issue
Block a user