aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0691-More-Projectile-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0691-More-Projectile-API.patch')
-rw-r--r--patches/server/0691-More-Projectile-API.patch58
1 files changed, 56 insertions, 2 deletions
diff --git a/patches/server/0691-More-Projectile-API.patch b/patches/server/0691-More-Projectile-API.patch
index 18230771e2..a70deb02fb 100644
--- a/patches/server/0691-More-Projectile-API.patch
+++ b/patches/server/0691-More-Projectile-API.patch
@@ -5,6 +5,7 @@ Subject: [PATCH] More Projectile API
== AT ==
public net.minecraft.world.entity.projectile.FishingHook timeUntilLured
+public net.minecraft.world.entity.projectile.FishingHook fishAngle
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaX
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaY
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaZ
@@ -19,7 +20,33 @@ public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecr
public net.minecraft.world.entity.projectile.FireworkRocketEntity getDefaultItem()Lnet/minecraft/world/item/ItemStack;
Co-authored-by: Nassim Jahnke <[email protected]>
+Co-authored-by: SoSeDiK <[email protected]>
+diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+index 7d557c7ec6fb1763395f4920a170bd4e4ba6747f..e603307871b623ce437f4b1b68ab306fbdd9919d 100644
+--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
++++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+@@ -413,13 +413,18 @@ public class FishingHook extends Projectile {
+ }
+ } else {
+ // CraftBukkit start - logic to modify fishing wait time
+- this.timeUntilLured = Mth.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
+- this.timeUntilLured -= (this.applyLure) ? (this.lureSpeed * 20 * 5 >= this.maxWaitTime ? this.timeUntilLured - 1 : this.lureSpeed * 20 * 5) : 0; // Paper - Fix Lure infinite loop
++ resetTimeUntilLured(); // Paper - more projectile api - extract time until lured reset logic
+ // CraftBukkit end
+ }
+ }
+
+ }
++ // Paper start - more projectile api - extract time until lured reset logic
++ public void resetTimeUntilLured() {
++ this.timeUntilLured = Mth.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
++ this.timeUntilLured -= (this.applyLure) ? (this.lureSpeed * 20 * 5 >= this.maxWaitTime ? this.timeUntilLured - 1 : this.lureSpeed * 20 * 5) : 0; // Paper - Fix Lure infinite loop
++ }
++ // Paper end - more projectile api - extract time until lured reset logic
+
+ public boolean calculateOpenWater(BlockPos pos) {
+ FishingHook.OpenWaterType entityfishinghook_waterposition = FishingHook.OpenWaterType.INVALID;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 40348e45b02be9a0b397a883940a476fb6738ef4..ccb7aa341e3087255bce1f6fb953d33584147fd3 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -351,10 +378,10 @@ index c9e15a9d82dee935293b2e7e233f5b9b2d822448..3c31ff72f3e77ee0d9231fec5f15267c
+ // Paper end - Expose firework item directly + manually setting flight
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
-index 6e2f91423371ead9890095cf4b1e2299c4dcba28..ad1aeea80877f2cdb9e8ad9c5b46f95dd76b3335 100644
+index 6e2f91423371ead9890095cf4b1e2299c4dcba28..9d8f4b7176e60180565e3134a14ecf19060f2621 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
-@@ -196,4 +196,15 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
+@@ -196,4 +196,42 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
public HookState getState() {
return HookState.values()[this.getHandle().currentState.ordinal()];
}
@@ -368,6 +395,33 @@ index 6e2f91423371ead9890095cf4b1e2299c4dcba28..ad1aeea80877f2cdb9e8ad9c5b46f95d
+ public void setWaitTime(int ticks) {
+ this.getHandle().timeUntilLured = ticks;
+ }
++
++ @Override
++ public int getTimeUntilBite() {
++ return this.getHandle().timeUntilHooked;
++ }
++
++ @Override
++ public void setTimeUntilBite(final int ticks) {
++ com.google.common.base.Preconditions.checkArgument(ticks >= 1, "Cannot set time until bite to less than 1 (%s<1)", ticks);
++ final FishingHook hook = this.getHandle();
++
++ // Reset the fish angle hook only when this call "enters" the fish into the lure stage.
++ final boolean alreadyInLuringPhase = hook.timeUntilHooked > 0 && hook.timeUntilLured <= 0;
++ if (!alreadyInLuringPhase) {
++ hook.fishAngle = net.minecraft.util.Mth.nextFloat(hook.random, hook.minLureAngle, hook.maxLureAngle);
++ hook.timeUntilLured = 0;
++ }
++
++ hook.timeUntilHooked = ticks;
++ }
++
++ @Override
++ public void resetFishingState() {
++ final FishingHook hook = this.getHandle();
++ hook.resetTimeUntilLured();
++ hook.timeUntilHooked = 0; // Reset time until hooked, will be repopulated once lured time is ticked down.
++ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java