diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/data/BiomeColors.java b/common/src/main/java/xyz/jpenilla/squaremap/common/data/BiomeColors.java index 2506e2b5..d92cf86e 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/data/BiomeColors.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/data/BiomeColors.java @@ -21,6 +21,7 @@ import xyz.jpenilla.squaremap.common.util.Colors; import xyz.jpenilla.squaremap.common.util.chunksnapshot.ChunkSnapshot; +// TODO(1.21.2): pale forest colors, general foliage colors (dark forest?) @DefaultQualifier(NonNull.class) public final class BiomeColors { private static final int BLOCKPOS_BIOME_CACHE_SIZE = 4096; diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/task/render/AbstractRender.java b/common/src/main/java/xyz/jpenilla/squaremap/common/task/render/AbstractRender.java index c6628bd2..c83ec3a2 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/task/render/AbstractRender.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/task/render/AbstractRender.java @@ -342,7 +342,7 @@ private void scanTopRow(final Image image, final int[] lastY, final ChunkSnapsho private int effectiveMaxHeight(final ChunkSnapshot chunk) { return this.mapWorld.config().MAP_MAX_HEIGHT == -1 - ? chunk.getMaxBuildHeight() + ? chunk.getMaxY() : this.mapWorld.config().MAP_MAX_HEIGHT; } @@ -380,7 +380,7 @@ private int scanBlock(final ChunkSnapshot chunk, final int imgX, final int imgZ, final int topY = chunk.getHeight(Heightmap.Types.WORLD_SURFACE, imgX, imgZ) + 1; mutablePos.set(blockX, Math.min(topY, this.effectiveMaxHeight(chunk)), blockZ); - if (topY > chunk.getMinBuildHeight() + 1) { + if (topY > chunk.getMinY() + 1) { state = this.mapWorld.config().MAP_ITERATE_UP ? this.iterateUp(chunk, mutablePos) : this.iterateDown(chunk, mutablePos); @@ -430,19 +430,19 @@ private BlockState iterateDown(final ChunkSnapshot chunk, final BlockPos.Mutable do { mutablePos.move(Direction.DOWN); state = chunk.getBlockState(mutablePos); - } while (!state.isAir() && mutablePos.getY() > chunk.getMinBuildHeight()); + } while (!state.isAir() && mutablePos.getY() > chunk.getMinY()); } do { mutablePos.move(Direction.DOWN); state = chunk.getBlockState(mutablePos); - } while ((this.mapWorld.getMapColor(state) == Colors.clearMapColor() || this.mapWorld.advanced().invisibleBlocks.contains(state.getBlock())) && mutablePos.getY() > chunk.getMinBuildHeight()); + } while ((this.mapWorld.getMapColor(state) == Colors.clearMapColor() || this.mapWorld.advanced().invisibleBlocks.contains(state.getBlock())) && mutablePos.getY() > chunk.getMinY()); return state; } private BlockState iterateUp(final ChunkSnapshot chunk, final BlockPos.MutableBlockPos mutablePos) { BlockState state; int height = mutablePos.getY(); - mutablePos.setY(chunk.getMinBuildHeight()); + mutablePos.setY(chunk.getMinY()); if (chunk.dimensionType().hasCeiling()) { do { mutablePos.move(Direction.UP); @@ -456,7 +456,7 @@ private BlockState iterateUp(final ChunkSnapshot chunk, final BlockPos.MutableBl do { mutablePos.move(Direction.DOWN); state = chunk.getBlockState(mutablePos); - } while ((this.mapWorld.getMapColor(state) == Colors.clearMapColor() || this.mapWorld.advanced().invisibleBlocks.contains(state.getBlock())) && mutablePos.getY() > chunk.getMinBuildHeight()); + } while ((this.mapWorld.getMapColor(state) == Colors.clearMapColor() || this.mapWorld.advanced().invisibleBlocks.contains(state.getBlock())) && mutablePos.getY() > chunk.getMinY()); return state; } @@ -477,7 +477,7 @@ private record DepthResult(int depth, BlockState state) { } private static @Nullable DepthResult findDepthIfFluid(final BlockPos blockPos, final BlockState state, final ChunkSnapshot chunk) { - if (blockPos.getY() > chunk.getMinBuildHeight() && !state.getFluidState().isEmpty()) { + if (blockPos.getY() > chunk.getMinY() && !state.getFluidState().isEmpty()) { BlockState fluidState; int fluidDepth = 0; @@ -488,7 +488,7 @@ private record DepthResult(int depth, BlockState state) { mutablePos.setY(yBelowSurface--); fluidState = chunk.getBlockState(mutablePos); ++fluidDepth; - } while (yBelowSurface > chunk.getMinBuildHeight() && fluidDepth <= 10 && !fluidState.getFluidState().isEmpty()); + } while (yBelowSurface > chunk.getMinY() && fluidDepth <= 10 && !fluidState.getFluidState().isEmpty()); return new DepthResult(fluidDepth, fluidState); } diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/util/AbstractFluidColorExporter.java b/common/src/main/java/xyz/jpenilla/squaremap/common/util/AbstractFluidColorExporter.java index 50435504..b7186803 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/util/AbstractFluidColorExporter.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/util/AbstractFluidColorExporter.java @@ -19,6 +19,7 @@ import org.spongepowered.configurate.yaml.YamlConfigurationLoader; import xyz.jpenilla.squaremap.common.data.DirectoryProvider; +// TODO(1.21.2): test fabric & neoforge @DefaultQualifier(NonNull.class) public abstract class AbstractFluidColorExporter { private final DirectoryProvider directoryProvider; @@ -29,8 +30,8 @@ protected AbstractFluidColorExporter(final DirectoryProvider directoryProvider) public final void export(final RegistryAccess registryAccess) { final Map map = new HashMap<>(); - registryAccess.registryOrThrow(Registries.BLOCK).holders().forEach(holder -> { - final Block block = holder.value(); + registryAccess.lookupOrThrow(Registries.BLOCK).entrySet().forEach(entry -> { + final Block block = entry.getValue(); final @Nullable Fluid fluid = this.fluid(block); if (fluid == null || fluid == Fluids.WATER || fluid == Fluids.LAVA @@ -39,7 +40,7 @@ public final void export(final RegistryAccess registryAccess) { } final @Nullable String color = this.color(fluid); if (color != null) { - map.put(holder.key().location().toString(), color); + map.put(entry.getKey().location().toString(), color); } }); diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/util/Util.java b/common/src/main/java/xyz/jpenilla/squaremap/common/util/Util.java index 5c6278fd..ed7fe5c6 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/util/Util.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/util/Util.java @@ -93,7 +93,7 @@ public static T requireEntry(final Registry registry, final ResourceLocat if (!registry.containsKey(location)) { throw new IllegalArgumentException("No such entry '" + location + "' in registry '" + registry.key() + "'"); } - return requireNonNull(registry.get(location)); + return requireNonNull(registry.getValue(location)); } public static String levelConfigName(final ServerLevel level) { @@ -124,7 +124,7 @@ public static Registry biomeRegistry(final CommonLevelAccessor level) { } public static Registry biomeRegistry(final RegistryAccess registryAccess) { - return registryAccess.registryOrThrow(Registries.BIOME); + return registryAccess.lookupOrThrow(Registries.BIOME); } public static @Nullable Manifest manifest(final Class clazz) { diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshot.java b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshot.java index 2d137d17..972f4739 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshot.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshot.java @@ -36,7 +36,7 @@ public interface ChunkSnapshot extends LevelHeightAccessor, BiomeManager.NoiseBi @SuppressWarnings({"unchecked", "rawtypes"}) static ChunkSnapshot snapshot(final Level level, final ChunkAccess chunk, final boolean biomesOnly) { - final LevelHeightAccessor heightAccessor = LevelHeightAccessor.create(chunk.getMinBuildHeight(), chunk.getHeight()); + final LevelHeightAccessor heightAccessor = LevelHeightAccessor.create(chunk.getMinY(), chunk.getHeight()); final int sectionCount = heightAccessor.getSectionsCount(); final LevelChunkSection[] sections = chunk.getSections(); final PalettedContainer[] states = new PalettedContainer[sectionCount]; diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshotImpl.java b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshotImpl.java index 0ab9de61..568d8755 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshotImpl.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/ChunkSnapshotImpl.java @@ -78,8 +78,8 @@ public int getHeight() { } @Override - public int getMinBuildHeight() { - return this.heightAccessor.getMinBuildHeight(); + public int getMinY() { + return this.heightAccessor.getMinY(); } @Override @@ -89,7 +89,7 @@ public boolean sectionEmpty(final int sectionIndex) { @Override public Holder getNoiseBiome(final int quartX, final int quartY, final int quartZ) { - final int minQuartY = QuartPos.fromBlock(this.getMinBuildHeight()); + final int minQuartY = QuartPos.fromBlock(this.getMinY()); final int maxQuartY = minQuartY + QuartPos.fromBlock(this.getHeight()) - 1; final int clampedQuartY = Mth.clamp(quartY, minQuartY, maxQuartY); final int sectionIndex = this.getSectionIndex(QuartPos.toBlock(clampedQuartY)); diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/HeightmapSnapshot.java b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/HeightmapSnapshot.java index 76d8ef71..502c56d5 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/HeightmapSnapshot.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/HeightmapSnapshot.java @@ -29,7 +29,7 @@ public int getFirstAvailable(final int x, final int z) { } private int getFirstAvailable(final int index) { - return this.data.get(index) + this.heightAccessor.getMinBuildHeight(); + return this.data.get(index) + this.heightAccessor.getMinY(); } private static int getIndex(final int x, final int z) { diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/VanillaChunkSnapshotProvider.java b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/VanillaChunkSnapshotProvider.java index cb098873..a1eb0072 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/VanillaChunkSnapshotProvider.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/util/chunksnapshot/VanillaChunkSnapshotProvider.java @@ -128,6 +128,6 @@ private static boolean preHeightChangeFullChunk(final CompoundTag chunkTag) { if (targetStatus == null) { return false; } - return BuiltInRegistries.CHUNK_STATUS.get(targetStatus).isOrAfter(ChunkStatus.SPAWN); + return BuiltInRegistries.CHUNK_STATUS.getValue(targetStatus).isOrAfter(ChunkStatus.SPAWN); } } diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/FabricFluidColorExporter.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/FabricFluidColorExporter.java index 65778e59..dd952544 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/FabricFluidColorExporter.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/FabricFluidColorExporter.java @@ -45,17 +45,17 @@ public static int color(final Fluid fluid, final FluidRenderHandler renderHandle final ColorBlender blender = new ColorBlender(); for (int i = 0; i < sprite.contents().width(); i++) { for (int h = 0; h < sprite.contents().height(); h++) { - final int rgba = ((SpriteContentsExtension) sprite.contents()).getPixelRGBA(i, h); + final int rgba = ((SpriteContentsExtension) sprite.contents()).getPixel(i, h); blender.addColor(rgba); } } return color( - Colors.abgrToArgb(blender.result()), + blender.result(), renderHandler.getFluidColor(null, null, fluid.defaultFluidState()) ); } public interface SpriteContentsExtension { - int getPixelRGBA(int x, int y); + int getPixel(int x, int y); } } diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ServerPlayerMixin.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ServerPlayerMixin.java index 281a0ac4..db111b68 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ServerPlayerMixin.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ServerPlayerMixin.java @@ -2,7 +2,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.portal.DimensionTransition; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -12,14 +11,14 @@ @Mixin(ServerPlayer.class) abstract class ServerPlayerMixin { @Inject( - method = "changeDimension", + method = "teleport(Lnet/minecraft/world/level/portal/TeleportTransition;)Lnet/minecraft/server/level/ServerPlayer;", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/players/PlayerList;sendLevelInfo(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/server/level/ServerLevel;)V", shift = At.Shift.AFTER ) ) - void injectChangeDimension(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { + void injectChangeDimension(final CallbackInfoReturnable cir) { ServerPlayerEvents.WORLD_CHANGED.invoker().worldChanged((ServerPlayer) (Object) this); } } diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/SpriteContentsMixin.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/SpriteContentsMixin.java index d8026631..9992b66d 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/SpriteContentsMixin.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/SpriteContentsMixin.java @@ -12,8 +12,8 @@ abstract class SpriteContentsMixin implements FabricFluidColorExporter.SpriteCon @Shadow @Final private NativeImage originalImage; @Override - public int getPixelRGBA(final int x, final int y) { + public int getPixel(final int x, final int y) { // always gets from frame 0 of animated texture - return this.originalImage.getPixelRGBA(x, y); + return this.originalImage.getPixel(x, y); } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index df7f74f7..dcc97dad 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ hangar-publish = { id = "io.papermc.hangar-publish-plugin", version = "0.1.2" } javadoc-links = { id = "org.incendo.cloud-build-logic.javadoc-links", version = "0.0.15" } [versions] -minecraft = "1.21.1" +minecraft = "1.21.2" checkerQual = "3.48.0" cloud = "2.0.0" cloudMinecraft = "2.0.0-beta.10" @@ -17,14 +17,14 @@ configurate = "4.1.2" adventure = "4.17.0" examination = "1.3.0" option = "1.0.0" -adventurePlatformMod = "6.0.0" +adventurePlatformMod = "6.1.0-SNAPSHOT" paperApi = "1.20.2-R0.1-SNAPSHOT" bStats = "3.1.0" -fabricApi = "0.105.0+1.21.1" +fabricApi = "0.106.1+1.21.2" fabricLoader = "0.16.7" cardinalComponents = "6.1.1" guice = "7.0.0" -neoforge = "21.1.68" +neoforge = "21.2.0-beta" htmlSanitizer = "20240325.1" # buildSrc @@ -33,7 +33,7 @@ sponge-gradle = "2.2.0" shadow = "8.3.0" vanillaGradle = "0.2.1-SNAPSHOT" mod-publish-plugin = "0.7.4" -loom = "1.7-SNAPSHOT" +loom = "1.7.298" paperweight = "1.7.3" [libraries] diff --git a/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/ForgeFluidColorExporter.java b/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/ForgeFluidColorExporter.java index b0a16661..bbe3e68c 100644 --- a/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/ForgeFluidColorExporter.java +++ b/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/ForgeFluidColorExporter.java @@ -47,6 +47,6 @@ public static int color(final FluidType fluidType) { blender.addColor(rgba); } } - return color(Colors.abgrToArgb(blender.result()), ext.getTintColor()); + return color(blender.result(), ext.getTintColor()); } } diff --git a/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/event/ForgeMapUpdates.java b/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/event/ForgeMapUpdates.java index 761a4067..e0c7baa9 100644 --- a/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/event/ForgeMapUpdates.java +++ b/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/event/ForgeMapUpdates.java @@ -63,9 +63,11 @@ public void register() { if (!(event.getLevel() instanceof ServerLevel level)) { return; } + /* TODO: getAffectedBlocks not yet implemented in 1.21.2 for (final BlockPos affectedBlock : event.getAffectedBlocks()) { this.markBlock(level, affectedBlock); } + */ }); NeoForge.EVENT_BUS.addListener(EventPriority.LOWEST, false, (BlockGrowFeatureEvent event) -> { if (!(event.getLevel() instanceof ServerLevel level)) { diff --git a/settings.gradle.kts b/settings.gradle.kts index 23c8f2e1..1e477c5e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,8 +21,8 @@ rootProject.name = "squaremap" setupSubproject("api") setupSubproject("common") -setupSubproject("paper") -include(":squaremap-paper:folia") +//setupSubproject("paper") +//include(":squaremap-paper:folia") setupSubproject("fabric") setupSubproject("neoforge") setupSubproject("sponge")