Skip to content

Commit

Permalink
update to 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Oct 27, 2024
1 parent a07f265 commit d4fae3e
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Maven
<dependency>
<groupId>maven.modrinth</groupId>
<artifactId>pl3xmap</artifactId>
<version>1.21-500</version>
<version>1.21.3-509</version>
<scope>provided</scope>
</dependency>
```
Expand All @@ -101,7 +101,7 @@ repositories {
}
dependencies {
compileOnly 'maven.modrinth:pl3xmap:1.21-500'
compileOnly 'maven.modrinth:pl3xmap:1.21.3-509'
}
```

Expand Down
6 changes: 3 additions & 3 deletions bukkit/src/main/java/net/pl3x/map/bukkit/BukkitWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public BukkitWorld(@NotNull ServerLevel level, @NotNull String name) {
init();

// register biomes
Set<Map.Entry<ResourceKey<Biome>, Biome>> entries = level.registryAccess().registryOrThrow(Registries.BIOME).entrySet();
Set<Map.Entry<ResourceKey<Biome>, Biome>> entries = level.registryAccess().lookupOrThrow(Registries.BIOME).entrySet();
for (Map.Entry<ResourceKey<Biome>, 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()));
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bukkit/src/main/java/net/pl3x/map/bukkit/Pl3xMapImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.<ServerLevel>getLevel().registryAccess().registryOrThrow(Registries.BIOME).get(ResourceLocation.parse(biome.getKey()));
Biome nms = world.<ServerLevel>getLevel().registryAccess().lookupOrThrow(Registries.BIOME).getValue(ResourceLocation.parse(biome.getKey()));
if (nms == null) {
return null;
}
Expand All @@ -170,7 +170,7 @@ public int getColorForPower(byte power) {

@Override
protected void loadBlocks() {
Set<Map.Entry<ResourceKey<Block>, Block>> entries = MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).entrySet();
Set<Map.Entry<ResourceKey<Block>, Block>> entries = MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BLOCK).entrySet();
for (Map.Entry<ResourceKey<Block>, 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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -67,13 +67,13 @@ public abstract class MapInstanceMixin implements MapInstance {
private boolean skip;

@Inject(method = "<init>", 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;
Expand Down Expand Up @@ -185,18 +185,18 @@ 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;
}

// vanilla color exists; grab color from pl3xmap tile
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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -65,7 +65,7 @@ public FabricWorld(@NotNull ServerLevel level, @NotNull String name) {
init();

// register biomes
Set<Map.Entry<ResourceKey<Biome>, Biome>> entries = level.registryAccess().registryOrThrow(Registries.BIOME).entrySet();
Set<Map.Entry<ResourceKey<Biome>, Biome>> entries = level.registryAccess().lookupOrThrow(Registries.BIOME).entrySet();
for (Map.Entry<ResourceKey<Biome>, 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()));
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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.<ServerLevel>getLevel().registryAccess().registryOrThrow(Registries.BIOME).get(ResourceLocation.parse(biome.getKey()));
Biome nms = world.<ServerLevel>getLevel().registryAccess().lookupOrThrow(Registries.BIOME).getValue(ResourceLocation.parse(biome.getKey()));
if (nms == null) {
return null;
}
Expand All @@ -228,7 +228,7 @@ public int getColorForPower(byte power) {

@Override
protected void loadBlocks() {
Set<Map.Entry<ResourceKey<Block>, Block>> entries = this.server.registryAccess().registryOrThrow(Registries.BLOCK).entrySet();
Set<Map.Entry<ResourceKey<Block>, Block>> entries = this.server.registryAccess().lookupOrThrow(Registries.BLOCK).entrySet();
for (Map.Entry<ResourceKey<Block>, 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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions fabric/src/main/resources/pl3xmap.accesswidener
Original file line number Diff line number Diff line change
@@ -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;
24 changes: 12 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d4fae3e

Please sign in to comment.