mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Make setVelocity method of Fireballs change the travel direction to an arbitrary vector (#9815)
This commit is contained in:
parent
ec584ef1c3
commit
62d89ef9e4
2 changed files with 34 additions and 5 deletions
|
@ -0,0 +1,30 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TrollyLoki <trollyloki@gmail.com>
|
||||
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;
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue