diff --git a/CHANGELOG.md b/CHANGELOG.md index cb792fd0..a4e6db56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2001.2.1] + +### Fixes +* Fixed "Show waypoints in world" client config setting being ignored for waypoint icons + * It was only working to suppress beacons when set to false, now it suppresses icons too +* Fixed NPE when checking for fake players which had a null name or UUID in their GameProfile +* Client memory fix; eliminated some unnecessary region data loading when players change chunk settings (claiming, forceloading) + ## [2001.2.0] ### Changed diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index 66a562d2..a0de9213 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -698,7 +698,7 @@ public void renderHud(GuiGraphics graphics, float tickDelta) { RenderSystem.enableDepthTest(); - if (worldMatrix != null) { + if (worldMatrix != null && FTBChunksClientConfig.IN_WORLD_WAYPOINTS.get()) { drawInWorldIcons(mc, graphics, tickDelta, playerX, playerY, playerZ, scaledWidth, scaledHeight); } } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegion.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegion.java index f0b4e07e..392704c3 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegion.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegion.java @@ -256,6 +256,16 @@ public MapChunk getOrCreateMapChunk(XZ xz) { return chunks.computeIfAbsent(xz, p -> new MapChunk(this, p).created()); } + public MapChunk getChunkForAbsoluteChunkPos(XZ pos) { + XZ effectivePos = pos.x() != (pos.x() & 31) || pos.z() != (pos.z() & 31) ? + XZ.of(pos.x() & 31, pos.z() & 31) : + pos; + + synchronized (dimension.getManager().lock) { + return getOrCreateMapChunk(effectivePos); + } + } + public void addMapChunk(MapChunk mapChunk) { chunks.put(mapChunk.getPos(), mapChunk); } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegionData.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegionData.java index 735f672b..d2d4db72 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegionData.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapRegionData.java @@ -17,16 +17,29 @@ import java.util.zip.ZipOutputStream; public class MapRegionData { - // WLLLLBBB BBBBBBBB - waterLightAndBiome - // W - Water (x & 1) << 15 - // L - Light (x & 15) << 11 - // B - Biome (x & 0b111_11111111) - public final MapRegion region; + + // a region is a 512x512 block area + + // 16 bits per block pos; the height of the highest non-air block public final short[] height = new short[512 * 512]; + + // WLLLLBBB BBBBBBBB - waterLightAndBiome is packed into a 16-bit short + // W - Water - 1 bit (water/no water) - (x & 1) << 15 + // L - Light - 4 bits (16 light levels) - (x & 15) << 11 + // B - Biome - 11 bits (2048 possible biomes) - (x & 0b111_11111111) public final short[] waterLightAndBiome = new short[512 * 512]; + + // top 8 bits are bits 16-23 of the block index + // bottom 24 bits are the biome-tinted RGB of foliage public final int[] foliage = new int[512 * 512]; + + // top 8 bits are bits 8-15 of the block index + // bottom 24 bits are the biome-tinted RGB of grass public final int[] grass = new int[512 * 512]; + + // top 8 bits are bits 0-7 of the block index + // bottom 24 bits are the biome-tinted RGB of water public final int[] water = new int[512 * 512]; public MapRegionData(MapRegion r) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/UpdateChunkFromServerTask.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/UpdateChunkFromServerTask.java index e7b88957..b3a3e97d 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/UpdateChunkFromServerTask.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/UpdateChunkFromServerTask.java @@ -22,8 +22,7 @@ public UpdateChunkFromServerTask(MapDimension d, SendChunkPacket.SingleChunk c, @Override public void runMapTask() { dimension.getRegion(XZ.regionFromChunk(chunk.getX(), chunk.getZ())) - .getDataBlocking() - .getChunk(XZ.of(chunk.getX(), chunk.getZ())) + .getChunkForAbsoluteChunkPos(XZ.of(chunk.getX(), chunk.getZ())) .updateFromServer(now, chunk, teamId); } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java index 2797126f..9bb9263d 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java @@ -1,5 +1,6 @@ package dev.ftb.mods.ftbchunks.data; +import com.mojang.authlib.GameProfile; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.architectury.hooks.level.entity.PlayerHooks; @@ -311,9 +312,7 @@ private boolean canFakePlayerUse(Player player, PrivacyMode mode) { boolean checkById = team.getProperty(FTBChunksProperties.ALLOW_FAKE_PLAYERS_BY_ID) && player.getUUID() != null; if (mode == PrivacyMode.ALLIES) { - return checkById && isAlly(player.getUUID()) - || getCachedFakePlayerNames().contains(player.getGameProfile().getName().toLowerCase(Locale.ROOT)) - || getCachedFakePlayerNames().contains(player.getGameProfile().getId().toString().toLowerCase(Locale.ROOT)); + return checkById && isAlly(player.getUUID()) || fakePlayerMatches(player.getGameProfile()); } else if (mode == PrivacyMode.PRIVATE) { return checkById && team.getRankForPlayer(player.getUUID()).isMemberOrBetter(); } @@ -321,6 +320,11 @@ private boolean canFakePlayerUse(Player player, PrivacyMode mode) { return false; } + private boolean fakePlayerMatches(GameProfile profile) { + return profile.getName() != null && getCachedFakePlayerNames().contains(profile.getName().toLowerCase(Locale.ROOT)) + || profile.getId() != null && getCachedFakePlayerNames().contains(profile.getId().toString().toLowerCase(Locale.ROOT)); + } + private Set getCachedFakePlayerNames() { if (fakePlayerNameCache == null) { fakePlayerNameCache = team.getProperty(FTBChunksProperties.ALLOW_NAMED_FAKE_PLAYERS).stream() diff --git a/gradle.properties b/gradle.properties index 06941442..be72d040 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.daemon=false mod_id=ftbchunks archives_base_name=ftb-chunks maven_group=dev.ftb.mods -mod_version=2001.2.0 +mod_version=2001.2.1 mod_author=FTB Team minecraft_version=1.20.1