make world identifier valid by hex encoding them

This commit is contained in:
Jakob Schulz
2026-11-01 00:46:13 +01:00
parent e22317f1fa
commit 1389f81c7c
5 changed files with 11 additions and 7 deletions
@@ -27,6 +27,9 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
import java.nio.charset.StandardCharsets;
import java.util.HexFormat;
@Linked
public class WorldIdentifier {
@@ -36,6 +39,10 @@ public class WorldIdentifier {
resourceKey = new ResourceKey<>(new ResourceLocation("minecraft", "dimension"), new ResourceLocation("steamwar", name));
}
public static void setArena(String map) {
set("arena/" + Core.getVersion() + "/" + HexFormat.of().formatHex(map.getBytes(StandardCharsets.UTF_8)));
}
public WorldIdentifier() {
TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, packet) -> {
if (resourceKey == null) return packet;