Apply fixes for Fabric 1.21.9 to build successfully

This commit is contained in:
ReuS 2025-10-02 19:13:31 +11:00
parent 687f92d5fa
commit adc68adc76
7 changed files with 24 additions and 25 deletions

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.10.5' id 'fabric-loom' version '1.11-SNAPSHOT'
} }
archivesBaseName = "Dynmap" archivesBaseName = "Dynmap"
@ -8,7 +8,7 @@ group = parent.group
eclipse { eclipse {
project { project {
name = "Dynmap(Fabric-1.21.6)" name = "Dynmap(Fabric-1.21.9)"
} }
} }
@ -34,7 +34,8 @@ dependencies {
shadow project(path: ':DynmapCore', configuration: 'shadow') shadow project(path: ':DynmapCore', configuration: 'shadow')
modCompileOnly "me.lucko:fabric-permissions-api:0.1-SNAPSHOT" // modCompileOnly "me.lucko:fabric-permissions-api:0.1-SNAPSHOT"
modCompileOnly files("../libs/fabric-permissions-api-0.1.jar")
compileOnly 'net.luckperms:api:5.4' compileOnly 'net.luckperms:api:5.4'
} }

View file

@ -1,6 +1,6 @@
minecraft_version=1.21.6 minecraft_version=1.21.9
# see https://fabricmc.net/develop/ # see https://fabricmc.net/develop/
yarn_mappings=1.21.6+build.1 yarn_mappings=1.21.9+build.1
loader_version=0.16.14 loader_version=0.17.2
fabric_version=0.128.2+1.21.6 fabric_version=0.133.14+1.21.9

View file

@ -259,7 +259,7 @@ public class DynmapPlugin {
} }
// TODO: Consider whether cheats are enabled for integrated server // TODO: Consider whether cheats are enabled for integrated server
return server.isSingleplayer() && server.isHost(server.getPlayerManager().getPlayer(player).getGameProfile()); return server.isSingleplayer() && server.isHost(server.getPlayerManager().getPlayer(player).getPlayerConfigEntry());
} }
boolean hasPerm(PlayerEntity psender, String permission) { boolean hasPerm(PlayerEntity psender, String permission) {

View file

@ -44,7 +44,7 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
uuid = this.player.getUuid(); uuid = this.player.getUuid();
GameProfile prof = this.player.getGameProfile(); GameProfile prof = this.player.getGameProfile();
if (prof != null) { if (prof != null) {
Property textureProperty = Iterables.getFirst(prof.getProperties().get("textures"), null); Property textureProperty = Iterables.getFirst(prof.properties().get("textures"), null);
if (textureProperty != null) { if (textureProperty != null) {
DynmapPlugin.TexturesPayload result = null; DynmapPlugin.TexturesPayload result = null;
@ -99,8 +99,8 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
return null; return null;
} }
Vec3d pos = player.getPos(); // Vec3d pos = player.movement;
return FabricAdapter.toDynmapLocation(plugin, player.getWorld(), pos.getX(), pos.getY(), pos.getZ()); return FabricAdapter.toDynmapLocation(plugin, player.getEntityWorld(), player.getX(), player.getY(), player.getZ());
} }
@Override @Override
@ -109,7 +109,7 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
return null; return null;
} }
World world = player.getWorld(); World world = player.getEntityWorld();
if (world != null) { if (world != null) {
return plugin.getWorld(world).getName(); return plugin.getWorld(world).getName();
} }

View file

@ -1,6 +1,5 @@
package org.dynmap.fabric_1_21_9; package org.dynmap.fabric_1_21_9;
import com.mojang.authlib.GameProfile;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.ModContainer;
import net.minecraft.block.AbstractSignBlock; import net.minecraft.block.AbstractSignBlock;
@ -14,6 +13,7 @@ import net.minecraft.server.BannedPlayerList;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PlayerManager; import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.PlayerConfigEntry;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.UserCache; import net.minecraft.util.UserCache;
import net.minecraft.util.Util; import net.minecraft.util.Util;
@ -63,9 +63,8 @@ public class FabricServer extends DynmapServerInterface {
this.biomeRegistry = server.getRegistryManager().getOrThrow(RegistryKeys.BIOME); this.biomeRegistry = server.getRegistryManager().getOrThrow(RegistryKeys.BIOME);
} }
private Optional<GameProfile> getProfileByName(String player) { private Optional<PlayerConfigEntry> getProfileByName(String playerName) {
UserCache cache = server.getUserCache(); return Optional.ofNullable(PlayerConfigEntry.fromNickname(playerName));
return cache.findByName(player);
} }
public final Registry<Biome> getBiomeRegistry() { public final Registry<Biome> getBiomeRegistry() {
@ -202,12 +201,10 @@ public class FabricServer extends DynmapServerInterface {
public boolean isPlayerBanned(String pid) { public boolean isPlayerBanned(String pid) {
PlayerManager scm = server.getPlayerManager(); PlayerManager scm = server.getPlayerManager();
BannedPlayerList bl = scm.getUserBanList(); BannedPlayerList bl = scm.getUserBanList();
try {
return bl.contains(getProfileByName(pid).get()); return getProfileByName(pid)
} catch (NoSuchElementException e) { .map(profile -> bl.get(profile) != null)
/* If this profile doesn't exist, default to "banned" for good measure. */ .orElse(true);
return true;
}
} }
@Override @Override

View file

@ -2,6 +2,7 @@ package org.dynmap.fabric_1_21_9;
import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKey;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldProperties.SpawnPoint;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.Heightmap; import net.minecraft.world.Heightmap;
import net.minecraft.world.LightType; import net.minecraft.world.LightType;
@ -96,7 +97,7 @@ public class FabricWorld extends DynmapWorld {
@Override @Override
public DynmapLocation getSpawnLocation() { public DynmapLocation getSpawnLocation() {
if (world != null) { if (world != null) {
BlockPos spawnPos = world.getLevelProperties().getSpawnPos(); BlockPos spawnPos = world.getLevelProperties().getSpawnPoint().getPos().toImmutable();
spawnloc.x = spawnPos.getX(); spawnloc.x = spawnPos.getX();
spawnloc.y = spawnPos.getY(); spawnloc.y = spawnPos.getY();
spawnloc.z = spawnPos.getZ(); spawnloc.z = spawnPos.getZ();

View file

@ -27,8 +27,8 @@
"accessWidener" : "dynmap.accesswidener", "accessWidener" : "dynmap.accesswidener",
"depends": { "depends": {
"fabricloader": ">=0.16.9", "fabricloader": ">=0.17.2",
"fabric": ">=0.108.0", "fabric": ">=0.108.0",
"minecraft": ["1.21.6","1.21.7", "1.21.8"] "minecraft": ["1.21.9"]
} }
} }