Fix Lure infinite loop (#6850)

This commit is contained in:
HexedHero 2022-01-18 06:54:31 +00:00 committed by GitHub
parent 60b7d5ee0c
commit 17e1f65669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ index ec3fb557fa31b153de20c4990066182a774dd489..5896b4e4646d722db5622a424fa26f42
+ }
}
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 73c5a0e6f1db6bf438fe516e213f40f0645ed954..dc248a0a91795fb67cc0e15cb0012364e739fbaa 100644
index 73c5a0e6f1db6bf438fe516e213f40f0645ed954..b11f97e4ecc8d623d8a8a69e9e7a6205b96072f1 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -82,6 +82,10 @@ public class FishingHook extends Projectile {
@ -36,3 +36,12 @@ index 73c5a0e6f1db6bf438fe516e213f40f0645ed954..dc248a0a91795fb67cc0e15cb0012364
}
public FishingHook(EntityType<? extends FishingHook> type, Level world) {
@@ -397,7 +401,7 @@ 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 : 0;
+ this.timeUntilLured -= (this.applyLure) ? (this.lureSpeed * 20 * 5 >= this.maxWaitTime ? this.timeUntilLured - 1 : this.lureSpeed * 20 * 5) : 0; // Paper - Fix Lure infinite loop
// CraftBukkit end
}
}