@@ -50,11 +50,11 @@ public static void initialize() {
50
50
final var centerPos = getOriginForNextSpawn (player );
51
51
final var checkRange = LittleJoysConfig .getActive ().fishingSpots .minimumDistanceBetween ;
52
52
final var spawnRange = LittleJoysConfig .getActive ().fishingSpots .spawnDistance ;
53
- final var closestFishingSpot = poiManager .findClosest (it -> it .is (ModPoiTypeTags .FISHING_SPOTS ),
53
+ final var fishingSpotInRange = poiManager .getInRange (it -> it .is (ModPoiTypeTags .FISHING_SPOTS ),
54
54
centerPos ,
55
55
checkRange ,
56
- PoiManager .Occupancy .ANY );
57
- if (closestFishingSpot .isEmpty ()) {
56
+ PoiManager .Occupancy .ANY ). findAny () ;
57
+ if (fishingSpotInRange .isEmpty ()) {
58
58
final var offsetX = random .nextInt (spawnRange + spawnRange ) - spawnRange ;
59
59
final var offsetZ = random .nextInt (spawnRange + spawnRange ) - spawnRange ;
60
60
final var randomOffsetPos = new BlockPos (centerPos .getX () + offsetX , centerPos .getX (), centerPos .getZ () + offsetZ );
@@ -64,10 +64,14 @@ public static void initialize() {
64
64
final var totalSpots = ChunkLimitManager .get (level ).getTotalFishingSpotsInChunk (aboveSurfacePos );
65
65
final var maxSpots = LittleJoysConfig .getActive ().fishingSpots .totalLimitPerChunk ;
66
66
if (maxSpots > 0 && totalSpots >= maxSpots ) {
67
+ // If we have exceeded the total, don't bother re-checking until 10 seconds have passed
68
+ littleJoysData .putInt (FISHING_SPOT_COOLDOWN , 200 );
67
69
return ;
68
70
}
69
71
70
72
if (!level .getBlockState (aboveSurfacePos ).canBeReplaced ()) {
73
+ // If this position was bad, try again in a second
74
+ littleJoysData .putInt (FISHING_SPOT_COOLDOWN , 20 );
71
75
return ;
72
76
}
73
77
@@ -79,6 +83,9 @@ public static void initialize() {
79
83
ChunkLimitManager .get (level ).trackFishingSpot (aboveSurfacePos );
80
84
littleJoysData .putInt (FISHING_SPOT_COOLDOWN , Math .round (LittleJoysConfig .getActive ().fishingSpots .spawnIntervalSeconds * 20 ));
81
85
}, () -> littleJoysData .putInt (FISHING_SPOT_COOLDOWN , 20 ));
86
+ } else {
87
+ // If we have one in range, don't bother re-checking until 10 seconds have passed
88
+ littleJoysData .putInt (FISHING_SPOT_COOLDOWN , 200 );
82
89
}
83
90
}
84
91
});
0 commit comments