13
0
geforkt von Mirrors/Paper

Make setVelocity method of Fireballs change the travel direction to an arbitrary vector (#9815)

Dieser Commit ist enthalten in:
TrollyLoki 2023-10-10 17:09:45 -04:00
Ursprung ec584ef1c3
Commit 62d89ef9e4
2 geänderte Dateien mit 34 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -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;

Datei anzeigen

@ -121,7 +121,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return Optional.of(InteractionResult.FAIL); return Optional.of(InteractionResult.FAIL);
} }
entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F); 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 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- 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 { @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return; return;
} }
- entityTracker.broadcast(this.getHandle().getAddEntityPacket()); - entityTracker.broadcast(this.getHandle().getAddEntityPacket());
+ // Paper start, resend possibly desynced entity instead of add entity packet + // Paper start, resend possibly desynced entity instead of add entity packet
+ for (ServerPlayerConnection playerConnection : entityTracker.seenBy) { + for (ServerPlayerConnection playerConnection : entityTracker.seenBy) {
@ -137,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
} }
private static PermissibleBase getPermissibleBase() { 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 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -146,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { @@ -0,0 +0,0 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
protected void update() { protected void update() {
super.update(); super.update();
+ // Paper start, don't mark as dirty as this is handled in 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 // mark dirty, so that the client gets updated with item and rotation
- this.getHandle().getEntityData().markDirty(net.minecraft.world.entity.decoration.ItemFrame.DATA_ITEM); - 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_ITEM);
+ //this.getHandle().getEntityData().markDirty(net.minecraft.world.entity.decoration.ItemFrame.DATA_ROTATION); + //this.getHandle().getEntityData().markDirty(net.minecraft.world.entity.decoration.ItemFrame.DATA_ROTATION);
+ // Paper end + // Paper end
// update redstone // update redstone
if (!this.getHandle().generation) { if (!this.getHandle().generation) {