Reduce max tries in RTP Search to fix it

This commit is contained in:
zontreck 2024-01-22 00:15:36 -07:00
parent 11864385e4
commit e713101f59

View file

@ -25,7 +25,7 @@ public class RTP {
private static final List<Block> BLACKLIST = Lists.of(Blocks.LAVA, Blocks.WATER, Blocks.BEDROCK); private static final List<Block> BLACKLIST = Lists.of(Blocks.LAVA, Blocks.WATER, Blocks.BEDROCK);
private final int SEARCH_DIRECTION; private final int SEARCH_DIRECTION;
private final Heightmap.Types heightMapType; private final Heightmap.Types heightMapType;
private final WorldPosition position; public WorldPosition position;
private final ServerLevel dimension; private final ServerLevel dimension;
private int tries; private int tries;
@ -99,7 +99,7 @@ public class RTP {
} }
public void newPosition() { public void newPosition() {
if (!AriasEssentials.ALIVE || tries >= 25) return; if (!AriasEssentials.ALIVE || tries >= 5) return;
AriasEssentials.LOGGER.info("RTP starts looking for a new position"); AriasEssentials.LOGGER.info("RTP starts looking for a new position");
@ -109,18 +109,13 @@ public class RTP {
BlockPos bpos; BlockPos bpos;
do { do {
pos = new Vector3(rng.nextDouble(0xFFFF), 150, rng.nextDouble(0xFFFF)); pos = new Vector3(rng.nextDouble(0xFFFF), -60, rng.nextDouble(0xFFFF));
pos = spiralPositions(pos); pos = spiralPositions(pos);
position.Position = pos; position.Position = pos;
bpos = pos.asBlockPos(); bpos = pos.asBlockPos();
} while (!isValidPosition(bpos)); } while (!isValidPosition(bpos));
if (pos.y < -30 || pos.y >= position.getActualDimension().getLogicalHeight()) {
newPosition();
return;
}
tries++; tries++;
AriasEssentials.LOGGER.info("RTP returns a new position"); AriasEssentials.LOGGER.info("RTP returns a new position");
} }