diff --git a/README.md b/README.md index 279d413ed..f5fc192b3 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Maven maven.modrinth pl3xmap - 1.21-500 + 1.21.3-509 provided ``` @@ -101,7 +101,7 @@ repositories { } dependencies { - compileOnly 'maven.modrinth:pl3xmap:1.21-500' + compileOnly 'maven.modrinth:pl3xmap:1.21.3-509' } ``` diff --git a/bukkit/src/main/java/net/pl3x/map/bukkit/BukkitWorld.java b/bukkit/src/main/java/net/pl3x/map/bukkit/BukkitWorld.java index 49faae157..76465c4db 100644 --- a/bukkit/src/main/java/net/pl3x/map/bukkit/BukkitWorld.java +++ b/bukkit/src/main/java/net/pl3x/map/bukkit/BukkitWorld.java @@ -65,7 +65,7 @@ public BukkitWorld(@NotNull ServerLevel level, @NotNull String name) { init(); // register biomes - Set, Biome>> entries = level.registryAccess().registryOrThrow(Registries.BIOME).entrySet(); + Set, Biome>> entries = level.registryAccess().lookupOrThrow(Registries.BIOME).entrySet(); for (Map.Entry, Biome> entry : entries) { if (getBiomeRegistry().size() > BiomeRegistry.MAX_INDEX) { Logger.debug(String.format("Cannot register any more biomes. Registered: %d Unregistered: %d", getBiomeRegistry().size(), entries.size() - getBiomeRegistry().size())); @@ -109,12 +109,12 @@ public boolean hasCeiling() { @Override public int getMinBuildHeight() { - return this.level.getMinBuildHeight(); + return this.level.getMinY(); } @Override public int getMaxBuildHeight() { - return this.level.getMaxBuildHeight(); + return this.level.getMaxY(); } @Override diff --git a/bukkit/src/main/java/net/pl3x/map/bukkit/Pl3xMapImpl.java b/bukkit/src/main/java/net/pl3x/map/bukkit/Pl3xMapImpl.java index 2679fd4f5..ced8d2f5f 100644 --- a/bukkit/src/main/java/net/pl3x/map/bukkit/Pl3xMapImpl.java +++ b/bukkit/src/main/java/net/pl3x/map/bukkit/Pl3xMapImpl.java @@ -154,7 +154,7 @@ public int getColorForPower(byte power) { @Override public net.pl3x.map.core.world.@Nullable Block getFlower(@NotNull World world, net.pl3x.map.core.world.@NotNull Biome biome, int blockX, int blockY, int blockZ) { // https://github.com/Draradech/FlowerMap (CC0-1.0 license) - Biome nms = world.getLevel().registryAccess().registryOrThrow(Registries.BIOME).get(ResourceLocation.parse(biome.getKey())); + Biome nms = world.getLevel().registryAccess().lookupOrThrow(Registries.BIOME).getValue(ResourceLocation.parse(biome.getKey())); if (nms == null) { return null; } @@ -170,7 +170,7 @@ public int getColorForPower(byte power) { @Override protected void loadBlocks() { - Set, Block>> entries = MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).entrySet(); + Set, Block>> entries = MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BLOCK).entrySet(); for (Map.Entry, Block> entry : entries) { if (getBlockRegistry().size() > BlockRegistry.MAX_INDEX) { Logger.debug(String.format("Cannot register any more biomes. Registered: %d Unregistered: %d", getBlockRegistry().size(), entries.size() - getBlockRegistry().size())); diff --git a/fabric/src/main/java/net/pl3x/map/fabric/client/Pl3xMapFabricClient.java b/fabric/src/main/java/net/pl3x/map/fabric/client/Pl3xMapFabricClient.java index ec9ad0cc0..9a5425d54 100644 --- a/fabric/src/main/java/net/pl3x/map/fabric/client/Pl3xMapFabricClient.java +++ b/fabric/src/main/java/net/pl3x/map/fabric/client/Pl3xMapFabricClient.java @@ -164,6 +164,6 @@ public void setServerUrl(String url) { } public void updateAllMapTextures() { - Minecraft.getInstance().gameRenderer.getMapRenderer().maps.values().forEach(tex -> ((MapInstance) tex).updateImage()); + Minecraft.getInstance().getMapTextureManager().maps.values().forEach(tex -> ((MapInstance) tex).updateImage()); } } diff --git a/fabric/src/main/java/net/pl3x/map/fabric/client/mixin/MapInstanceMixin.java b/fabric/src/main/java/net/pl3x/map/fabric/client/mixin/MapInstanceMixin.java index 2d1ac23bb..9bdc45a89 100644 --- a/fabric/src/main/java/net/pl3x/map/fabric/client/mixin/MapInstanceMixin.java +++ b/fabric/src/main/java/net/pl3x/map/fabric/client/mixin/MapInstanceMixin.java @@ -27,8 +27,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import java.awt.image.BufferedImage; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.gui.MapRenderer; import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.resources.MapTextureManager; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.pl3x.map.core.util.Colors; @@ -43,7 +43,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(MapRenderer.MapInstance.class) +@Mixin(MapTextureManager.MapInstance.class) public abstract class MapInstanceMixin implements MapInstance { @Final @Shadow @@ -67,13 +67,13 @@ public abstract class MapInstanceMixin implements MapInstance { private boolean skip; @Inject(method = "", at = @At("TAIL")) - private void ctor(@NotNull MapRenderer renderer, int id, @NotNull MapItemSavedData data, @NotNull CallbackInfo ci) { + private void ctor(@NotNull MapTextureManager renderer, int id, @NotNull MapItemSavedData data, @NotNull CallbackInfo ci) { this.mod = Pl3xMapFabricClient.getInstance(); // there's got to be a better way :3 this.id = id; } - @Inject(method = "updateTexture()V", at = @At("HEAD"), cancellable = true) - private void updateTexture(@NotNull CallbackInfo ci) { + @Inject(method = "updateTextureIfNeeded()V", at = @At("HEAD"), cancellable = true) + private void updateTextureIfNeeded(@NotNull CallbackInfo ci) { if (!this.mod.isEnabled()) { // custom map renderers are disabled; show vanilla map return; @@ -185,7 +185,7 @@ private boolean updateMapTexture() { // check if vanilla color exists if (color >> 2 == 0) { // vanilla color missing (fog of war); draw transparent pixel - pixels.setPixelRGBA(x, z, 0); + pixels.setPixel(x, z, 0); continue; } @@ -193,10 +193,10 @@ private boolean updateMapTexture() { pl3xColor = this.image.getRGB(x, z); if (pl3xColor == 0) { // pl3xmap color is missing; fallback to vanilla color - pixels.setPixelRGBA(x, z, MapColor.getColorFromPackedId(color)); + pixels.setPixel(x, z, MapColor.getColorFromPackedId(color)); } else { // draw pl3xmap tile pixel - pixels.setPixelRGBA(x, z, pl3xColor); + pixels.setPixel(x, z, pl3xColor); } } } diff --git a/fabric/src/main/java/net/pl3x/map/fabric/common/network/ClientboundMapPayload.java b/fabric/src/main/java/net/pl3x/map/fabric/common/network/ClientboundMapPayload.java index 36c0d3e5a..6091d1824 100644 --- a/fabric/src/main/java/net/pl3x/map/fabric/common/network/ClientboundMapPayload.java +++ b/fabric/src/main/java/net/pl3x/map/fabric/common/network/ClientboundMapPayload.java @@ -46,13 +46,13 @@ public static void handle(ClientboundMapPayload payload, ClientPlayNetworking.Co switch (payload.response) { case Constants.ERROR_NO_SUCH_MAP, Constants.ERROR_NO_SUCH_WORLD, Constants.ERROR_NOT_VANILLA_MAP -> { - MapInstance texture = (MapInstance) Minecraft.getInstance().gameRenderer.getMapRenderer().maps.get(payload.mapId); + MapInstance texture = (MapInstance) Minecraft.getInstance().getMapTextureManager().maps.get(payload.mapId); if (texture != null) { texture.skip(); } } case Constants.RESPONSE_SUCCESS -> { - MapInstance texture = (MapInstance) Minecraft.getInstance().gameRenderer.getMapRenderer().maps.get(payload.mapId); + MapInstance texture = (MapInstance) Minecraft.getInstance().getMapTextureManager().maps.get(payload.mapId); if (texture != null) { texture.setData(payload.scale, payload.centerX, payload.centerZ, payload.worldName); } diff --git a/fabric/src/main/java/net/pl3x/map/fabric/server/FabricWorld.java b/fabric/src/main/java/net/pl3x/map/fabric/server/FabricWorld.java index 69ec44701..30db39005 100644 --- a/fabric/src/main/java/net/pl3x/map/fabric/server/FabricWorld.java +++ b/fabric/src/main/java/net/pl3x/map/fabric/server/FabricWorld.java @@ -54,7 +54,7 @@ public FabricWorld(@NotNull ServerLevel level, @NotNull String name) { level.getSeed(), Point.of(level.getLevelData().getSpawnPos().getX(), level.getLevelData().getSpawnPos().getZ()), Type.get(level.dimension().location().toString()), - level.getChunkSource().getDataStorage().dataFolder.toPath().getParent().resolve("region") + level.getChunkSource().getDataStorage().dataFolder.getParent().resolve("region") ); this.level = level; @@ -65,7 +65,7 @@ public FabricWorld(@NotNull ServerLevel level, @NotNull String name) { init(); // register biomes - Set, Biome>> entries = level.registryAccess().registryOrThrow(Registries.BIOME).entrySet(); + Set, Biome>> entries = level.registryAccess().lookupOrThrow(Registries.BIOME).entrySet(); for (Map.Entry, Biome> entry : entries) { if (getBiomeRegistry().size() > BiomeRegistry.MAX_INDEX) { Logger.debug(String.format("Cannot register any more biomes. Registered: %d Unregistered: %d", getBiomeRegistry().size(), entries.size() - getBiomeRegistry().size())); @@ -109,12 +109,12 @@ public boolean hasCeiling() { @Override public int getMinBuildHeight() { - return this.level.getMinBuildHeight(); + return this.level.getMinY(); } @Override public int getMaxBuildHeight() { - return this.level.getMaxBuildHeight(); + return this.level.getMaxY(); } @Override diff --git a/fabric/src/main/java/net/pl3x/map/fabric/server/Pl3xMapFabricServer.java b/fabric/src/main/java/net/pl3x/map/fabric/server/Pl3xMapFabricServer.java index 32511ef94..3084e355f 100644 --- a/fabric/src/main/java/net/pl3x/map/fabric/server/Pl3xMapFabricServer.java +++ b/fabric/src/main/java/net/pl3x/map/fabric/server/Pl3xMapFabricServer.java @@ -38,7 +38,7 @@ import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.kyori.adventure.platform.AudienceProvider; -import net.kyori.adventure.platform.fabric.FabricServerAudiences; +import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences; import net.minecraft.SharedConstants; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; @@ -73,7 +73,7 @@ public class Pl3xMapFabricServer extends Pl3xMap implements DedicatedServerModIn private MinecraftServer server; private ModContainer modContainer; - private FabricServerAudiences adventure; + private MinecraftServerAudiences adventure; private boolean firstTick = true; @@ -127,7 +127,7 @@ public void onInitializeServer() { ServerLifecycleEvents.SERVER_STARTED.register(server -> { this.server = server; - this.adventure = FabricServerAudiences.of(this.server); + this.adventure = MinecraftServerAudiences.of(this.server); enable(); @@ -212,7 +212,7 @@ public int getColorForPower(byte power) { @Override public net.pl3x.map.core.world.@Nullable Block getFlower(@NotNull World world, net.pl3x.map.core.world.@NotNull Biome biome, int blockX, int blockY, int blockZ) { // https://github.com/Draradech/FlowerMap (CC0-1.0 license) - Biome nms = world.getLevel().registryAccess().registryOrThrow(Registries.BIOME).get(ResourceLocation.parse(biome.getKey())); + Biome nms = world.getLevel().registryAccess().lookupOrThrow(Registries.BIOME).getValue(ResourceLocation.parse(biome.getKey())); if (nms == null) { return null; } @@ -228,7 +228,7 @@ public int getColorForPower(byte power) { @Override protected void loadBlocks() { - Set, Block>> entries = this.server.registryAccess().registryOrThrow(Registries.BLOCK).entrySet(); + Set, Block>> entries = this.server.registryAccess().lookupOrThrow(Registries.BLOCK).entrySet(); for (Map.Entry, Block> entry : entries) { if (getBlockRegistry().size() > BlockRegistry.MAX_INDEX) { Logger.debug(String.format("Cannot register any more biomes. Registered: %d Unregistered: %d", getBlockRegistry().size(), entries.size() - getBlockRegistry().size())); diff --git a/fabric/src/main/java/net/pl3x/map/fabric/server/command/FabricSender.java b/fabric/src/main/java/net/pl3x/map/fabric/server/command/FabricSender.java index 5346c9460..c885e3239 100644 --- a/fabric/src/main/java/net/pl3x/map/fabric/server/command/FabricSender.java +++ b/fabric/src/main/java/net/pl3x/map/fabric/server/command/FabricSender.java @@ -26,7 +26,7 @@ import java.util.Objects; import java.util.UUID; import net.kyori.adventure.audience.Audience; -import net.kyori.adventure.platform.fabric.FabricServerAudiences; +import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.level.ServerPlayer; import net.pl3x.map.core.Pl3xMap; @@ -55,7 +55,7 @@ public FabricSender(@NotNull CommandSourceStack sender) { @Override public @NotNull Audience audience() { - return ((FabricServerAudiences) Pl3xMap.api().adventure()).audience(getSender()); + return ((MinecraftServerAudiences) Pl3xMap.api().adventure()).audience(getSender()); } @Override diff --git a/fabric/src/main/resources/pl3xmap.accesswidener b/fabric/src/main/resources/pl3xmap.accesswidener index 1efdadf67..83cd7cba9 100644 --- a/fabric/src/main/resources/pl3xmap.accesswidener +++ b/fabric/src/main/resources/pl3xmap.accesswidener @@ -1,12 +1,12 @@ accessWidener v2 named # client -accessible class net/minecraft/client/gui/MapRenderer$MapInstance -accessible method net/minecraft/client/gui/MapRenderer$MapInstance updateTexture ()V -accessible field net/minecraft/client/gui/MapRenderer maps Lit/unimi/dsi/fastutil/ints/Int2ObjectMap; +accessible class net/minecraft/client/resources/MapTextureManager$MapInstance +accessible method net/minecraft/client/resources/MapTextureManager$MapInstance updateTextureIfNeeded ()V +accessible field net/minecraft/client/resources/MapTextureManager maps Lit/unimi/dsi/fastutil/ints/Int2ObjectMap; # server accessible class net/minecraft/world/level/biome/Biome$ClimateSettings accessible field net/minecraft/world/level/biome/Biome climateSettings Lnet/minecraft/world/level/biome/Biome$ClimateSettings; -accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File; +accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/nio/file/Path; accessible field net/minecraft/commands/CommandSourceStack source Lnet/minecraft/commands/CommandSource; diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fb4e4c056..ce6b06f44 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,29 +1,29 @@ [versions] -bukkit="1.21.1-R0.1-SNAPSHOT" -minecraft="1.21.1" +bukkit="1.21.3-R0.1-SNAPSHOT" +minecraft="1.21.3" # https://fabricmc.net/develop/ -fabricApi="0.102.1+1.21.1" -fabricLoader="0.16.2" -fabricLoom="1.7-SNAPSHOT" +fabricApi="0.107.0+1.21.3" +fabricLoader="0.16.7" +fabricLoom="1.8-SNAPSHOT" #forge="1.20.2-48.0.6" #forgeGradle="[6.0,6.2)" #forgeLoader="[48,)" minotaur="2.+" # https://github.com/modrinth/minotaur -paperweight="1.7.2" # https://github.com/PaperMC/Paperweight +paperweight="1.7.4" # https://github.com/PaperMC/Paperweight indra-git="3.1.3" # https://github.com/KyoriPowered/indra -shadowJar="8.3.0" # https://github.com/GradleUp/shadow +shadowJar="8.3.3" # https://github.com/GradleUp/shadow adventure="4.18.0-SNAPSHOT" adventureBukkit="4.3.5-SNAPSHOT" # https://github.com/KyoriPowered/adventure-platform -adventureFabric="5.14.2-SNAPSHOT" # https://github.com/KyoriPowered/adventure-platform-fabric +adventureFabric="6.1.0-SNAPSHOT" # https://github.com/KyoriPowered/adventure-platform-fabric -cloud="2.0.0-rc.2" # https://github.com/incendo/cloud -cloud-minecraft="2.0.0-beta.9" # https://github.com/Incendo/cloud-minecraft -cloud-minecraft-modded="2.0.0-beta.7" # https://github.com/Incendo/cloud-minecraft-modded -cloud-processors="1.0.0-beta.3" # https://github.com/Incendo/cloud-processors +cloud="2.0.0" # https://github.com/incendo/cloud +cloud-minecraft="2.0.0-beta.10" # https://github.com/Incendo/cloud-minecraft +cloud-minecraft-modded="2.0.0-beta.9" # https://github.com/Incendo/cloud-minecraft-modded +cloud-processors="1.0.0-rc.1" # https://github.com/Incendo/cloud-processors caffeine="3.1.8" # https://github.com/ben-manes/caffeine gson="2.10.1" # https://github.com/google/gson diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138c..9355b4155 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME