From 62d89ef9e4dca6376a34855c11158a86537a0392 Mon Sep 17 00:00:00 2001 From: TrollyLoki Date: Tue, 10 Oct 2023 17:09:45 -0400 Subject: [PATCH] Make setVelocity method of Fireballs change the travel direction to an arbitrary vector (#9815) --- ...-method-of-Fireballs-change-the-trav.patch | 30 +++++++++++++++++++ patches/server/Properly-resend-entities.patch | 9 +++--- 2 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 patches/server/Make-setVelocity-method-of-Fireballs-change-the-trav.patch diff --git a/patches/server/Make-setVelocity-method-of-Fireballs-change-the-trav.patch b/patches/server/Make-setVelocity-method-of-Fireballs-change-the-trav.patch new file mode 100644 index 0000000000..298b956041 --- /dev/null +++ b/patches/server/Make-setVelocity-method-of-Fireballs-change-the-trav.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TrollyLoki +Date: Tue, 10 Oct 2023 00:45:01 -0400 +Subject: [PATCH] Make setVelocity method of Fireballs change the travel + direction to an arbitrary vector + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +@@ -0,0 +0,0 @@ public class CraftFireball extends AbstractProjectile implements Fireball { + update(); // SPIGOT-6579 + } + ++ // Paper start - set direction without normalizing ++ @Override ++ public void setVelocity(Vector velocity) { ++ Preconditions.checkArgument(velocity != null, "Vector velocity cannot be null"); ++ velocity.checkFinite(); ++ this.getHandle().xPower = velocity.getX(); ++ this.getHandle().yPower = velocity.getY(); ++ this.getHandle().zPower = velocity.getZ(); ++ update(); ++ } ++ // Paper end ++ + @Override + public AbstractHurtingProjectile getHandle() { + return (AbstractHurtingProjectile) entity; diff --git a/patches/server/Properly-resend-entities.patch b/patches/server/Properly-resend-entities.patch index a5700b6179..3c9e05dd92 100644 --- a/patches/server/Properly-resend-entities.patch +++ b/patches/server/Properly-resend-entities.patch @@ -121,7 +121,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return Optional.of(InteractionResult.FAIL); } entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F); - diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -129,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return; } - + - entityTracker.broadcast(this.getHandle().getAddEntityPacket()); + // Paper start, resend possibly desynced entity instead of add entity packet + for (ServerPlayerConnection playerConnection : entityTracker.seenBy) { @@ -137,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } - + private static PermissibleBase getPermissibleBase() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -146,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { protected void update() { super.update(); - + + // Paper start, don't mark as dirty as this is handled in super.update() // mark dirty, so that the client gets updated with item and rotation - this.getHandle().getEntityData().markDirty(net.minecraft.world.entity.decoration.ItemFrame.DATA_ITEM); @@ -154,6 +153,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + //this.getHandle().getEntityData().markDirty(net.minecraft.world.entity.decoration.ItemFrame.DATA_ITEM); + //this.getHandle().getEntityData().markDirty(net.minecraft.world.entity.decoration.ItemFrame.DATA_ROTATION); + // Paper end - + // update redstone if (!this.getHandle().generation) {