Prevent negative in lure times - Fixes GH-1583

This commit is contained in:
Zach Brown 2019-04-05 00:09:29 -04:00
parent c4ff33a9e5
commit 26bbc23a01
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76
2 changed files with 22 additions and 20 deletions

View file

@ -1,11 +1,11 @@
From 12dd50f4836a33df93b0ab65175a5cdf1f842e90 Mon Sep 17 00:00:00 2001
From 0412e6ba2083b44da0a780abf51da476268e1107 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:14:11 -0600
Subject: [PATCH] Configurable fishing time ranges
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a3c0d9159..cacf58607 100644
index 55d8e74f8..a55163a45 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -79,4 +79,12 @@ public class PaperWorldConfig {
@ -22,18 +22,20 @@ index a3c0d9159..cacf58607 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index a9bd59418..7c119282b 100644
index 83cfbd218..fd6ada184 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -386,7 +386,7 @@ public class EntityFishingHook extends Entity {
@@ -386,8 +386,9 @@ public class EntityFishingHook extends Entity {
this.aw = MathHelper.nextInt(this.random, 20, 80);
}
} else {
- this.h = MathHelper.nextInt(this.random, 100, 600);
+ this.h = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper
this.h -= this.aA * 20 * 5;
+ this.h = Math.max(0, this.h); // Paper - Don't allow negative values
}
}
--
2.18.0
2.21.0

View file

@ -1,4 +1,4 @@
From 46e0d985edf2b7562b12d4419d5315fd658e25ea Mon Sep 17 00:00:00 2001
From e9824b65b2515743090f724cbc535d1297ffb033 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:31:46 -0500
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
@ -8,7 +8,7 @@ Adds lots of information about why this orb exists.
Replaces isFromBottle() with logic that persists entity reloads too.
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index dbf1089bac..66643be2bf 100644
index 1dc13fcc3..c674aa13d 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -450,13 +450,13 @@ public class Block implements IMaterial {
@ -28,7 +28,7 @@ index dbf1089bac..66643be2bf 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index b3fbc8249e..79d8be8d46 100644
index b3fbc8249..79d8be8d4 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -618,7 +618,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
@ -41,7 +41,7 @@ index b3fbc8249e..79d8be8d46 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 3030dd9c31..404a222b45 100644
index 3030dd9c3..404a222b4 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -15,9 +15,59 @@ public class EntityExperienceOrb extends Entity {
@ -120,10 +120,10 @@ index 3030dd9c31..404a222b45 100644
public void d(EntityHuman entityhuman) {
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 23f7d36b55..e1c685eede 100644
index c13e1ff6f..7fb136a2d 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -467,7 +467,7 @@ public class EntityFishingHook extends Entity {
@@ -468,7 +468,7 @@ public class EntityFishingHook extends Entity {
this.world.addEntity(entityitem);
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
if (playerFishEvent.getExpToDrop() > 0) {
@ -133,7 +133,7 @@ index 23f7d36b55..e1c685eede 100644
// CraftBukkit end
if (itemstack1.getItem().a(TagsItem.FISHES)) {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index f58ebe3c23..f2e38b9f35 100644
index c0ef0c51f..3bc1f8f9b 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -354,7 +354,8 @@ public abstract class EntityLiving extends Entity {
@ -147,7 +147,7 @@ index f58ebe3c23..f2e38b9f35 100644
this.expToDrop = 0;
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
index a5e1939e05..e73dba09a6 100644
index a5e1939e0..e73dba09a 100644
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
@@ -36,7 +36,7 @@ public class EntityThrownExpBottle extends EntityProjectile {
@ -160,7 +160,7 @@ index a5e1939e05..e73dba09a6 100644
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index ebe397b15a..78acac4ca7 100644
index ebe397b15..78acac4ca 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -412,7 +412,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
@ -173,7 +173,7 @@ index ebe397b15a..78acac4ca7 100644
if (this.tradingPlayer instanceof EntityPlayer) {
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index bf061cf064..55f9787680 100644
index bf061cf06..55f978768 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -122,7 +122,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
@ -186,7 +186,7 @@ index bf061cf064..55f9787680 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 0baf0100c9..6ae6afa339 100644
index 0baf0100c..6ae6afa33 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -391,7 +391,7 @@ public class PlayerInteractManager {
@ -199,7 +199,7 @@ index 0baf0100c9..6ae6afa339 100644
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
index 5ac554d65e..d70c4dda5a 100644
index 5ac554d65..d70c4dda5 100644
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
@@ -9,7 +9,7 @@ import org.bukkit.event.inventory.FurnaceExtractEvent;
@ -221,7 +221,7 @@ index 5ac554d65e..d70c4dda5a 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0f3bf13efe..36d27c2a3e 100644
index 671802819..d72f393a7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1354,7 +1354,7 @@ public class CraftWorld implements World {
@ -234,7 +234,7 @@ index 0f3bf13efe..36d27c2a3e 100644
// not sure what this can do
if (LightningStrike.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
index 3a09cab3d4..3302af0e45 100644
index 3a09cab3d..3302af0e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
@@ -18,6 +18,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
@ -257,5 +257,5 @@ index 3a09cab3d4..3302af0e45 100644
public EntityExperienceOrb getHandle() {
return (EntityExperienceOrb) entity;
--
2.20.1
2.21.0