Correctly launch WindCharges (#11418)

The launch API on LivingEntity only respected the WindCharge type, not
its near-clone BreezeWindCharge.

This commit correctly accounts for BreezeWindCharge in
CraftLivingEntity.
This commit is contained in:
Bjarne Koll 2024-09-21 20:08:31 +02:00
parent 2bb8e69297
commit a3916fd4da

View file

@ -527,6 +527,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
if (LingeringPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle());
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
launch = new net.minecraft.world.entity.projectile.WitherSkull(world, this.getHandle(), vec);
} else if (DragonFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.world.entity.projectile.DragonFireball(world, this.getHandle(), vec);
- } else if (WindCharge.class.isAssignableFrom(projectile)) {
- launch = EntityType.WIND_CHARGE.create(world);
- ((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).setOwner(this.getHandle());
- ((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).assignDirectionalMovement(vec, 0.1D);
+ // Paper start - more projectile API - correctly launch wind charges
+ } else if (org.bukkit.entity.AbstractWindCharge.class.isAssignableFrom(projectile)) {
+ if (org.bukkit.entity.BreezeWindCharge.class.isAssignableFrom(projectile)) {
+ launch = EntityType.BREEZE_WIND_CHARGE.create(world);
+ } else {
+ launch = EntityType.WIND_CHARGE.create(world);
+ }
+ ((net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) launch).setOwner(this.getHandle());
+ ((net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // Paper - copied from net.minecraft.world.item.WindChargeItem.use
+ // Paper end - more projectile API - correctly launch wind charges
} else {
launch = new LargeFireball(world, this.getHandle(), vec, 1);
}
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else if (Firework.class.isAssignableFrom(projectile)) {
Location location = this.getEyeLocation();