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 {
id 'fabric-loom' version '1.10.5'
id 'fabric-loom' version '1.11-SNAPSHOT'
}
archivesBaseName = "Dynmap"
@ -8,7 +8,7 @@ group = parent.group
eclipse {
project {
name = "Dynmap(Fabric-1.21.6)"
name = "Dynmap(Fabric-1.21.9)"
}
}
@ -34,7 +34,8 @@ dependencies {
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'
}

View file

@ -1,6 +1,6 @@
minecraft_version=1.21.6
minecraft_version=1.21.9
# see https://fabricmc.net/develop/
yarn_mappings=1.21.6+build.1
loader_version=0.16.14
fabric_version=0.128.2+1.21.6
yarn_mappings=1.21.9+build.1
loader_version=0.17.2
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
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) {

View file

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

View file

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

View file

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

View file

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