Expose power on fireballs (#10302)

This commit is contained in:
TonytheMacaroni 2024-03-20 17:33:34 -04:00 committed by GitHub
parent de620b8480
commit 41ffa0cf8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
112 changed files with 76 additions and 42 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..d3c319298d360967b853cf0168c0a1833f094779
index 0000000000000000000000000000000000000000..8c2fd2c1120d634052f9bc345365272ad3a67b6f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
@@ -0,0 +1,106 @@
@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..d3c319298d360967b853cf0168c0a183
+ */
+ @NotNull
+ public Location getTo() {
+ return this.to;
+ return this.to.clone();
+ }
+
+ @NotNull

View File

@ -9,6 +9,7 @@ Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java
new file mode 100644
@ -413,6 +414,43 @@ index 9e7f42caab1204036f4203354c115fd40c6def92..138d2530de2410f4a9424dabd3e5ce0c
+ int getLifetimeTicks();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/bukkit/entity/Fireball.java
index 7a44707f2307dc4dbfea4de3f4baf3cc0490dc93..d0e82102425e54274be9c4769634d754319d6196 100644
--- a/src/main/java/org/bukkit/entity/Fireball.java
+++ b/src/main/java/org/bukkit/entity/Fireball.java
@@ -23,4 +23,32 @@ public interface Fireball extends Projectile, Explosive {
@NotNull
public Vector getDirection();
+ // Paper start - Expose power on fireball projectiles
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Note: For fireball entities, their movement is also controlled by their power.
+ *
+ * @param velocity New velocity to travel with
+ * @see #setPower(Vector)
+ */
+ @Override
+ public void setVelocity(@NotNull Vector velocity);
+
+ /**
+ * Sets the power of a fireball. The power determines the direction and magnitude of its acceleration.
+ *
+ * @param power the power
+ */
+ public void setPower(@NotNull Vector power);
+
+ /**
+ * Gets the power of a fireball. The power determines the direction and magnitude of its acceleration.
+ *
+ * @return the power
+ */
+ @NotNull
+ public Vector getPower();
+ // Paper end - Expose power on fireball projectiles
+
}
diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java
index c61a473453f33f9d10c330fc46cfa9d52251fe49..473a7e36ad64f866d1d2e09e2ecb2e9881668faf 100644
--- a/src/main/java/org/bukkit/entity/Fox.java

View File

@ -36,6 +36,7 @@ Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
index 8117578ced94aa6bf01871f6526a388385c4adf2..59699c59fdfc611177fdb3136f84ab539b17d9c9 100644
@ -666,6 +667,31 @@ index fc0f0e841dc974d080e1abb9bbafb5165801131f..d657fd2c507a5b215aeab0a5f3e9c2ee
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index 73cb7aa01af3eed71b05b1a539f082b26dcd8d60..e1a2f0924da6ebcdf332040f922226af5d8a2d45 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -59,6 +59,20 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
this.update(); // SPIGOT-6579
}
+ // Paper start - Expose power on fireball projectiles
+ @Override
+ public void setPower(final Vector power) {
+ this.getHandle().xPower = power.getX();
+ this.getHandle().yPower = power.getY();
+ this.getHandle().zPower = power.getZ();
+ }
+
+ @Override
+ public Vector getPower() {
+ return new Vector(this.getHandle().xPower, this.getHandle().yPower, this.getHandle().zPower);
+ }
+ // Paper end - Expose power on fireball projectiles
+
@Override
public AbstractHurtingProjectile getHandle() {
return (AbstractHurtingProjectile) this.entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
index 17164811bbcf983bef62c47bc99330074762267b..c455deb4fd2a7684bcc01a8212c362a2375c190b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java

View File

@ -1,30 +0,0 @@
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 2783e218d5e5c24787429237974e196761f4d02b..1d8aab2fda18c6e2bb30f6ba4a6325263267b628 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -46,6 +46,18 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
this.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 - set direction without normalizing
+
@Override
public AbstractHurtingProjectile getHandle() {
return (AbstractHurtingProjectile) this.entity;

View File

@ -31,7 +31,7 @@ index 8235dace0f4a1090dfbd403db34231ccafe5f30e..9816913ad729fd39c173364b92e5db06
if (entity.valid) {
MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bbc3f09105b19eabd3ebb8b9589412b8871739a1..67dfb7b6a8825a87ff69b8c33efd1c040db12bf0 100644
index 919c9ff3dd97d4bd2d41631176f9671f1987ad91..1de77621f159608f572ab4935ceb78863bb82c59 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -637,7 +637,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -50,7 +50,7 @@ index 7272dc058c575efee5ac2643ce41b7d12e346e89..ae5a2136a0e266d4c35190f5d3355299
if (entityitem == null) {
return null;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 67dfb7b6a8825a87ff69b8c33efd1c040db12bf0..198aeb71e958a3fa6f8eaa8f607120af483e597f 100644
index 1de77621f159608f572ab4935ceb78863bb82c59..5ab9ca815cb324c47c3e25a4d84a1b432bb393be 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2496,6 +2496,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -19375,7 +19375,7 @@ index 640db9f71608310a64e09f1e3e677c01e6ccd98a..f2a7cb6ebed7a4b4019a09af2a025f62
if (flag1) {
++this.converted;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 198aeb71e958a3fa6f8eaa8f607120af483e597f..89db78c05118a64d1b73ac05381e24c825d3cf76 100644
index 5ab9ca815cb324c47c3e25a4d84a1b432bb393be..42d01cec6eba11183409c9a93d068e61f5010153 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -480,6 +480,58 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -111,7 +111,7 @@ index bd8c96e914b156284bdbb960f168e63e1f122920..abb4c32e8b35de332fa517523e8c598e
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 89db78c05118a64d1b73ac05381e24c825d3cf76..dd785d11461541e8a93544142f7a3b4e43b2173d 100644
index 42d01cec6eba11183409c9a93d068e61f5010153..1f892783c16ab8fd863832255a2b03df381aa84e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -412,6 +412,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -26,7 +26,7 @@ index 461c27292af06a5150de8ec263d0c8527e8c5278..37245ff682837e7e8c9647f4afe30f0d
// CraftBukkit end
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dd785d11461541e8a93544142f7a3b4e43b2173d..f8ce3c92597b9fb2b8743a08088f33a7bf237c5d 100644
index 1f892783c16ab8fd863832255a2b03df381aa84e..720d08400915da9270ee4abf84bcb73f354ae2b4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -242,6 +242,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -315,7 +315,7 @@ index 2eeb0c78f2b717b59542b6b668371558ae2fcc25..6ec3fc801453fd54c25b642e6fa71c19
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index d931a4c6e633bf9c1b3e5e18e880e2ddbfe4aa2a..ce341f42b3a5e17fb6d1f7de8057e73137ae2a6e 100644
index b131a84865d9160d1b5d411515b69e967dbda66c..8d626fadcd4743b6472a2954d2b1b2ec89669814 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -186,6 +186,36 @@ public class Main {

View File

@ -236,7 +236,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f8ce3c92597b9fb2b8743a08088f33a7bf237c5d..3282327f1a85155d671dd63f3e5bf9b636a3e893 100644
index 720d08400915da9270ee4abf84bcb73f354ae2b4..28ca0aae8f8c755b558a03fc9283fa1a44697e1a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -56,6 +56,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;

View File

@ -122,7 +122,7 @@ index 9d18da228c6709e7665ba8babb6ee6d0b36b5dc5..af9f58328c09dddb2875f79128f906b8
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3282327f1a85155d671dd63f3e5bf9b636a3e893..2f3f1418b8ec765cfab5ece88972825d7d68cae5 100644
index 28ca0aae8f8c755b558a03fc9283fa1a44697e1a..ec01a97cac653fb1a2065289fe5b0c6824732bcb 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1063,8 +1063,43 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -2214,7 +2214,7 @@ index 594cb6ce4bfa6c42212000a1ed983ea95ee2c4bf..97b0119ac71284b3a223c089bec26d87
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2f3f1418b8ec765cfab5ece88972825d7d68cae5..51097f1d04d981db2823e8647b546658b8fd27c1 100644
index ec01a97cac653fb1a2065289fe5b0c6824732bcb..be2220457e941803b14d78c550d0db777c79a886 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1250,9 +1250,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -105,7 +105,7 @@ index 20201430ee8f28245aa845acb172d0f5d80458ff..9ea74d37cd951e0dc76d20ed8234b587
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 4dda44608320c2a872b23053a1c3de63b79741c2..757edf74751dc7183454656fda9cecc4eb601e4c 100644
index e3b6f2bf93710ea695b0c25c0b6968a8f24f0829..cdb739df2a285032d25d84f4464f202a7a3fa578 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -152,6 +152,43 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen

Some files were not shown because too many files have changed in this diff Show More