diff --git a/build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts b/build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts index 8aa1a867..e7390962 100644 --- a/build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts @@ -21,6 +21,7 @@ repositories { mavenContent { includeModule("org.incendo", "cloud-sponge") includeGroup("xyz.jpenilla") + includeModule("net.kyori", "adventure-platform-fabric") // TODO snapshotsOnly() } } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index b9476772..c7ab5352 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -8,6 +8,10 @@ minecraft { accessWideners(layout.projectDirectory.file("src/main/resources/squaremap-common.accesswidener")) } +configurations.all { + exclude("org.lwjgl", "lwjgl-freetype") // TODO: Don't care about running client :D (work around VG bug/Mojang repo weirdness?) +} + dependencies { api(projects.squaremapApi) api(libs.guice) { diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldAdvanced.java b/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldAdvanced.java index 65c8a346..72cd95e0 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldAdvanced.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldAdvanced.java @@ -36,7 +36,7 @@ private void invisibleBlocks() { "minecraft:short_grass", "minecraft:large_fern" ) - ).forEach(block -> this.invisibleBlocks.add(Util.requireEntry(BuiltInRegistries.BLOCK, new ResourceLocation(block)))); + ).forEach(block -> this.invisibleBlocks.add(Util.requireEntry(BuiltInRegistries.BLOCK, ResourceLocation.parse(block)))); } public final Set iterateUpBaseBlocks = new HashSet<>(); @@ -59,7 +59,7 @@ private void iterateUpBaseBlocks() { "minecraft:magma_block", "minecraft:basalt" ) - ).forEach(block -> this.iterateUpBaseBlocks.add(Util.requireEntry(BuiltInRegistries.BLOCK, new ResourceLocation(block)))); + ).forEach(block -> this.iterateUpBaseBlocks.add(Util.requireEntry(BuiltInRegistries.BLOCK, ResourceLocation.parse(block)))); } public final Reference2IntMap COLOR_OVERRIDES_BIOME_FOLIAGE = new Reference2IntOpenHashMap<>(); @@ -79,7 +79,7 @@ private void colorOverrideBiomeFoliageSettings() { Map.entry("minecraft:mangrove_swamp", "#6f9623") ) ).forEach((key, color) -> { - final Biome biome = Util.requireEntry(registry, new ResourceLocation(key)); + final Biome biome = Util.requireEntry(registry, ResourceLocation.parse(key)); this.COLOR_OVERRIDES_BIOME_FOLIAGE.put(biome, Colors.parseHex(color)); }); } @@ -95,7 +95,7 @@ private void colorOverrideBiomeGrassSettings() { "color-overrides.biomes.grass", Map.of() ).forEach((key, color) -> { - final Biome biome = Util.requireEntry(registry, new ResourceLocation(key)); + final Biome biome = Util.requireEntry(registry, ResourceLocation.parse(key)); this.COLOR_OVERRIDES_BIOME_GRASS.put(biome, Colors.parseHex(color)); }); } @@ -111,7 +111,7 @@ private void colorOverrideBiomeWaterSettings() { "color-overrides.biomes.water", Map.of() ).forEach((key, color) -> { - final Biome biome = Util.requireEntry(registry, new ResourceLocation(key)); + final Biome biome = Util.requireEntry(registry, ResourceLocation.parse(key)); this.COLOR_OVERRIDES_BIOME_WATER.put(biome, Colors.parseHex(color)); }); } @@ -154,7 +154,7 @@ private void colorOverrideBlocksSettings() { Map.entry("minecraft:glass", "#FFFFFF") ) ).forEach((key, color) -> { - final Block block = Util.requireEntry(BuiltInRegistries.BLOCK, new ResourceLocation(key)); + final Block block = Util.requireEntry(BuiltInRegistries.BLOCK, ResourceLocation.parse(key)); if (block != Blocks.AIR) { this.COLOR_OVERRIDES_BLOCKS.put(block, Colors.parseHex(color)); } diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/network/NetworkingHandler.java b/common/src/main/java/xyz/jpenilla/squaremap/common/network/NetworkingHandler.java index b09d2a10..292f009a 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/network/NetworkingHandler.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/network/NetworkingHandler.java @@ -28,7 +28,7 @@ */ @DefaultQualifier(NonNull.class) public final class NetworkingHandler { - public static final ResourceLocation CHANNEL = new ResourceLocation("squaremap:client"); + public static final ResourceLocation CHANNEL = ResourceLocation.parse("squaremap:client"); private final WorldManager worldManager; private final ServerAccess serverAccess; 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 0c97e462..b12a3c8a 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 @@ -70,7 +70,7 @@ private static boolean isFullStatus(final CompoundTag chunkTag) { } private static @Nullable ChunkAccess fullIfPresent(final ChunkHolder chunkHolder) { - return unwrap(chunkHolder.getLastAvailable()); + return unwrap(chunkHolder.getLatestChunk()); } private static @Nullable ChunkAccess unwrap(@Nullable ChunkAccess chunk) { @@ -80,7 +80,7 @@ private static boolean isFullStatus(final CompoundTag chunkTag) { if (chunk instanceof ImposterProtoChunk imposter) { chunk = imposter.getWrapped(); } - if (!chunk.getStatus().isOrAfter(ChunkStatus.FULL) && !preHeightChangeFullChunk(chunk)) { + if (!chunk.getPersistedStatus().isOrAfter(ChunkStatus.FULL) && !preHeightChangeFullChunk(chunk)) { return null; } return chunk; diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapComponentInitializer.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapComponentInitializer.java index e79b8996..9a8b7ba5 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapComponentInitializer.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapComponentInitializer.java @@ -15,7 +15,7 @@ @DefaultQualifier(NonNull.class) public class SquaremapComponentInitializer implements EntityComponentInitializer { public static final ComponentKey SQUAREMAP_PLAYER_COMPONENT = - ComponentRegistryV3.INSTANCE.getOrCreate(new ResourceLocation("squaremap:player_component"), PlayerComponent.class); + ComponentRegistryV3.INSTANCE.getOrCreate(ResourceLocation.parse("squaremap:player_component"), PlayerComponent.class); @Override public void registerEntityComponentFactories(final EntityComponentFactoryRegistry registry) { diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapFabric.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapFabric.java index 98a664a5..25a85f82 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapFabric.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/SquaremapFabric.java @@ -76,7 +76,7 @@ private void registerLifecycleListeners() { ServerLifecycleEvents.SERVER_STARTED.register($ -> this.common.updateCheck()); } - final ResourceLocation early = new ResourceLocation("squaremap:early"); + final ResourceLocation early = ResourceLocation.parse("squaremap:early"); ServerWorldEvents.LOAD.register(early, (server, level) -> this.worldManager.initWorld(level)); ServerWorldEvents.LOAD.addPhaseOrdering(early, Event.DEFAULT_PHASE); diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ChunkHolderMixin.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/GenerationChunkHolderMixin.java similarity index 85% rename from fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ChunkHolderMixin.java rename to fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/GenerationChunkHolderMixin.java index 684962c3..0f08742f 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/ChunkHolderMixin.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/GenerationChunkHolderMixin.java @@ -1,6 +1,6 @@ package xyz.jpenilla.squaremap.fabric.mixin; -import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.GenerationChunkHolder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ImposterProtoChunk; import org.spongepowered.asm.mixin.Mixin; @@ -9,8 +9,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import xyz.jpenilla.squaremap.fabric.event.MapUpdateEvents; -@Mixin(ChunkHolder.class) -abstract class ChunkHolderMixin { +@Mixin(GenerationChunkHolder.class) +abstract class GenerationChunkHolderMixin { @Inject( method = "replaceProtoChunk(Lnet/minecraft/world/level/chunk/ImposterProtoChunk;)V", at = @At("TAIL") diff --git a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/PlayerListMixin.java b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/PlayerListMixin.java index db265773..a85499f5 100644 --- a/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/PlayerListMixin.java +++ b/fabric/src/main/java/xyz/jpenilla/squaremap/fabric/mixin/PlayerListMixin.java @@ -3,6 +3,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.PlayerList; +import net.minecraft.world.entity.Entity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -14,18 +15,18 @@ abstract class PlayerListMixin { private final ThreadLocal preRespawnLevel = new ThreadLocal<>(); @Inject( - method = "respawn(Lnet/minecraft/server/level/ServerPlayer;Z)Lnet/minecraft/server/level/ServerPlayer;", + method = "Lnet/minecraft/server/players/PlayerList;respawn(Lnet/minecraft/server/level/ServerPlayer;ZLnet/minecraft/world/entity/Entity$RemovalReason;)Lnet/minecraft/server/level/ServerPlayer;", at = @At("HEAD") ) - void injectRespawnHead(ServerPlayer serverPlayer, boolean bl, CallbackInfoReturnable cir) { + void injectRespawnHead(ServerPlayer serverPlayer, boolean bl, Entity.RemovalReason removalReason, CallbackInfoReturnable cir) { this.preRespawnLevel.set((ServerLevel) serverPlayer.level()); } @Inject( - method = "respawn(Lnet/minecraft/server/level/ServerPlayer;Z)Lnet/minecraft/server/level/ServerPlayer;", + method = "Lnet/minecraft/server/players/PlayerList;respawn(Lnet/minecraft/server/level/ServerPlayer;ZLnet/minecraft/world/entity/Entity$RemovalReason;)Lnet/minecraft/server/level/ServerPlayer;", at = @At("RETURN") ) - void injectRespawnReturn(ServerPlayer oldPlayer, boolean bl, CallbackInfoReturnable cir) { + void injectRespawnReturn(ServerPlayer serverPlayer, boolean bl, Entity.RemovalReason removalReason, CallbackInfoReturnable cir) { final ServerLevel oldLevel = this.preRespawnLevel.get(); this.preRespawnLevel.remove(); final ServerPlayer player = cir.getReturnValue(); diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index fe81a7a7..773a90a4 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -36,7 +36,7 @@ "depends": { "fabric": "*", "fabricloader": ">=0.15.11", - "minecraft": "~1.20.6", + "minecraft": "~1.21", "cloud": "*", "adventure-platform-fabric": "*" } diff --git a/fabric/src/main/resources/squaremap-fabric.mixins.json b/fabric/src/main/resources/squaremap-fabric.mixins.json index 65f96286..ffd1ae14 100644 --- a/fabric/src/main/resources/squaremap-fabric.mixins.json +++ b/fabric/src/main/resources/squaremap-fabric.mixins.json @@ -5,7 +5,7 @@ "compatibilityLevel": "JAVA_17", "mixins": [ "BlockItemMixin", - "ChunkHolderMixin", + "GenerationChunkHolderMixin", "ChunkMapAccess", "CommandSourceStackAccess", "PlayerListMixin", diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5978c3b..b869cb6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,10 +6,10 @@ 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.20.6" +minecraft = "1.21" checkerQual = "3.44.0" cloud = "2.0.0-rc.2" -cloudMinecraft = "2.0.0-beta.8" +cloudMinecraft = "2.0.0-SNAPSHOT" cloudProcessors = "1.0.0-beta.3" cloudModded = "2.0.0-beta.7" cloudSponge = "2.0.0-SNAPSHOT" @@ -17,14 +17,14 @@ configurate = "4.1.2" adventure = "4.17.0" examination = "1.3.0" option = "1.0.0" -adventurePlatformFabric = "5.13.0" +adventurePlatformFabric = "5.14.0-SNAPSHOT" paperApi = "1.20.2-R0.1-SNAPSHOT" bStats = "3.0.2" -fabricApi = "0.99.0+1.20.6" +fabricApi = "0.100.1+1.21" fabricLoader = "0.15.11" -cardinalComponents = "6.0.0" +cardinalComponents = "6.1.0" guice = "7.0.0" -neoforge = "20.6.98-beta" +neoforge = "21.0.11-beta" htmlSanitizer = "20240325.1" # buildSrc 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 9fc9bf5f..b0a16661 100644 --- a/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/ForgeFluidColorExporter.java +++ b/neoforge/src/main/java/xyz/jpenilla/squaremap/forge/ForgeFluidColorExporter.java @@ -9,7 +9,6 @@ import net.minecraft.world.level.material.Fluid; import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; import net.neoforged.neoforge.fluids.FluidType; -import net.neoforged.neoforge.fluids.IFluidBlock; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.framework.qual.DefaultQualifier; @@ -27,9 +26,7 @@ private ForgeFluidColorExporter(final DirectoryProvider directoryProvider) { @Override protected @Nullable Fluid fluid(final Block block) { - if (block instanceof IFluidBlock fluidBlock) { - return fluidBlock.getFluid(); - } else if (block instanceof LiquidBlock liquidBlock) { + if (block instanceof LiquidBlock liquidBlock) { return liquidBlock.fluid; } return null; diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index a5b118fe..bbd15b35 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -16,14 +16,14 @@ displayTest = "IGNORE_ALL_VERSION" [[dependencies.squaremap]] modId = "neoforge" type = "required" -versionRange = "[20.6,)" +versionRange = "[21.0,)" ordering = "NONE" side = "BOTH" [[dependencies.squaremap]] modId = "minecraft" type = "required" -versionRange = "[1.20.6,1.21)" +versionRange = "[1.21,1.22)" ordering = "NONE" side = "BOTH" diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index 3de5a874..e8af61bd 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -9,8 +9,13 @@ plugins { val minecraftVersion = libs.versions.minecraft +configurations.mojangMappedServer { + exclude("io.papermc.paper", "paper-api") +} + dependencies { - paperweight.foliaDevBundle(minecraftVersion.map { "$it-R0.1-SNAPSHOT" }) + paperweight.paperDevBundle(minecraftVersion.map { "$it-R0.1-SNAPSHOT" }) + compileOnly("dev.folia:folia-api:1.20.6-R0.1-SNAPSHOT") implementation(projects.squaremapCommon) @@ -44,7 +49,7 @@ tasks { "version" to project.version, "website" to providers.gradleProperty("githubUrl").get(), "description" to project.description, - "apiVersion" to minecraftVersion.get().take(4), + "apiVersion" to minecraftVersion.get(), )) } } diff --git a/paper/src/main/java/xyz/jpenilla/squaremap/paper/util/chunksnapshot/PaperChunkSnapshotProvider.java b/paper/src/main/java/xyz/jpenilla/squaremap/paper/util/chunksnapshot/PaperChunkSnapshotProvider.java index ac843c2b..81d1b4e5 100644 --- a/paper/src/main/java/xyz/jpenilla/squaremap/paper/util/chunksnapshot/PaperChunkSnapshotProvider.java +++ b/paper/src/main/java/xyz/jpenilla/squaremap/paper/util/chunksnapshot/PaperChunkSnapshotProvider.java @@ -1,7 +1,7 @@ package xyz.jpenilla.squaremap.paper.util.chunksnapshot; import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor; -import io.papermc.paper.chunk.system.ChunkSystem; +import ca.spottedleaf.moonrise.patches.chunk_system.ChunkSystem; import io.papermc.paper.util.TickThread; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -28,7 +28,7 @@ record PaperChunkSnapshotProvider( public CompletableFuture<@Nullable ChunkSnapshot> asyncSnapshot(final int x, final int z) { return CompletableFuture.supplyAsync(() -> { final @Nullable ChunkAccess existing = this.level.getChunkIfLoadedImmediately(x, z); - if (existing != null && existing.getStatus().isOrAfter(ChunkStatus.FULL)) { + if (existing != null && existing.getPersistedStatus().isOrAfter(ChunkStatus.FULL)) { return CompletableFuture.completedFuture(existing); } else if (existing != null) { return CompletableFuture.<@Nullable ChunkAccess>completedFuture(null); @@ -51,7 +51,7 @@ record PaperChunkSnapshotProvider( if (chunk instanceof ImposterProtoChunk imposter) { chunk = imposter.getWrapped(); } - if (!chunk.getStatus().isOrAfter(ChunkStatus.FULL)) { + if (!chunk.getPersistedStatus().isOrAfter(ChunkStatus.FULL)) { if (chunk.getBelowZeroRetrogen() == null || !chunk.getBelowZeroRetrogen().targetStatus().isOrAfter(ChunkStatus.SPAWN)) { return null; } diff --git a/sponge/build.gradle.kts b/sponge/build.gradle.kts index 37c32bd4..60220884 100644 --- a/sponge/build.gradle.kts +++ b/sponge/build.gradle.kts @@ -10,6 +10,10 @@ plugins { val minecraftVersion = libs.versions.minecraft +configurations.all { + exclude("org.lwjgl", "lwjgl-freetype") // TODO: Don't care about running client :D (work around VG bug/Mojang repo weirdness?) +} + minecraft { version().set(minecraftVersion) accessWideners(project(":squaremap-common").layout.projectDirectory.file("src/main/resources/squaremap-common.accesswidener")) @@ -28,6 +32,7 @@ dependencies { } // https://github.com/SpongePowered/SpongeGradle/issues/70 +/* configurations.spongeRuntime { resolutionStrategy { eachDependency { @@ -37,9 +42,10 @@ configurations.spongeRuntime { } } } + */ sponge { - apiVersion("11.0.0-SNAPSHOT") + apiVersion("12.0.0-SNAPSHOT") plugin("squaremap") { loader { name(PluginLoaders.JAVA_PLAIN)