13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Bjarne Koll 2024-09-21 20:08:31 +02:00
Ursprung 2bb8e69297
Commit a3916fd4da

Datei anzeigen

@ -527,6 +527,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (ThrownPotion.class.isAssignableFrom(projectile)) { } else if (ThrownPotion.class.isAssignableFrom(projectile)) {
if (LingeringPotion.class.isAssignableFrom(projectile)) { if (LingeringPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle()); 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 { @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else if (Firework.class.isAssignableFrom(projectile)) { } else if (Firework.class.isAssignableFrom(projectile)) {
Location location = this.getEyeLocation(); Location location = this.getEyeLocation();