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