Merge pull request 'make world identifier valid by hex encoding them' (#521) from Jaki/SteamWar:main into main

Reviewed-on: SteamWar/SteamWar#521
This commit is contained in:
2026-11-01 07:10:30 +01:00
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;