Skip to content

Commit

Permalink
Fixed issues with biome random teleportation
Browse files Browse the repository at this point in the history
  • Loading branch information
Picono435 committed Dec 24, 2022
1 parent b198f64 commit 6351750
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void randomTeleport(ServerPlayer player, ServerLevel world, Resour
mutableBlockPos.setY(50);
mutableBlockPos.setZ(z);
} else {
Pair<BlockPos, Holder<Biome>> pair = world.findNearestBiome(biomeHolder -> biomeHolder.is(biomeResourceKey), mutableBlockPos.immutable(), 6400, 8);
Pair<BlockPos, Holder<Biome>> pair = world.findNearestBiome(biomeHolder -> biomeHolder.is(biomeResourceKey), player.getOnPos(), 6400, 8);
if(pair == null) {
TextComponent msg = new TextComponent(Messages.getMaxTries().replaceAll("\\{playerName\\}", player.getName().getString()).replaceAll("&", "§"));
player.sendMessage(msg, player.getUUID());
Expand All @@ -72,7 +72,7 @@ public static void randomTeleport(ServerPlayer player, ServerLevel world, Resour
mutableBlockPos.setY(y);
if(mutableBlockPos.getY() >= 200 || !isInBiomeWhitelist(world.getBiome(mutableBlockPos.immutable()).unwrapKey().get().location())) {
if(biomeResourceKey != null) {
Pair<BlockPos, Holder<Biome>> pair = world.findNearestBiome(biomeHolder -> biomeHolder.is(biomeResourceKey), mutableBlockPos.immutable(), 6400, 8);
Pair<BlockPos, Holder<Biome>> pair = world.findNearestBiome(biomeHolder -> biomeHolder.is(biomeResourceKey), player.getOnPos(), 6400, 8);
if(pair == null) {
TextComponent msg = new TextComponent(Messages.getMaxTries().replaceAll("\\{playerName\\}", player.getName().getString()).replaceAll("&", "§"));
player.sendMessage(msg, player.getUUID());
Expand Down

0 comments on commit 6351750

Please sign in to comment.