feat: add support for Minecraft 1.21.5 on Fabric (#809)

* feat: support Fabric 1.21.5 (working, awaiting adventure)

* fix: add world, server & dimension contexts during numerical perm calc, close #808

Not perfect but close-enough

* feat: more 1.21.5 work & fixes

* ci: update CI for 1.21.5

* build: update dependencies for 1.21.5
This commit is contained in:
William authored and GitHub committed 2025-05-03 21:24:53 +01:00
1 parent bab7ac5d40
commit e02dd9f8ef
17 files changed
+125 -26

No files matched your search

@@ -32,7 +32,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.kyori.adventure.audience.Audience;
//#if MC==12104
//#if MC>=12104
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
//#else
//$$ import net.kyori.adventure.platform.fabric.FabricServerAudiences;
@@ -98,7 +98,7 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
.orElseThrow(() -> new RuntimeException("Failed to get Mod Container"));
private final Map<String, Boolean> permissions = Maps.newHashMap();
//#if MC==12104
//#if MC>=12104
private MinecraftServerAudiences audiences;
//#else
//$$ private FabricServerAudiences audiences;
@@ -149,7 +149,7 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
private void onEnable(@NotNull MinecraftServer server) {
this.minecraftServer = server;
this.toilet = FabricToilet.create(getDumpOptions(), server);
//#if MC==12104
//#if MC>=12104
this.audiences = MinecraftServerAudiences.of(minecraftServer);
//#else
//$$ this.audiences = FabricServerAudiences.of(minecraftServer);
@@ -25,6 +25,7 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.fabricmc.fabric.api.util.TriState;
import net.kyori.adventure.audience.Audience;
import net.minecraft.entity.Entity;
import net.minecraft.registry.RegistryKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
@@ -68,17 +69,25 @@ public class FabricUser extends OnlineUser {
@Override
public Optional<Position> getBedSpawnPosition() {
final BlockPos spawn = player.getSpawnPointPosition();
if (spawn == null) {
//#if MC<=12104
//$$ final BlockPos spawn = player.getSpawnPointPosition();
//$$ final float angle = player.getSpawnAngle();
//$$ final RegistryKey<net.minecraft.world.World> world = player.getSpawnPointDimension();
//#else
final BlockPos spawn = player.getRespawn() == null ? null : player.getRespawn().pos();
final float angle = player.getRespawn() == null ? 0 : player.getRespawn().angle();
final RegistryKey<net.minecraft.world.World> world = player.getRespawn() == null ? null : player.getRespawn().dimension();
//#endif
if (spawn == null || world == null) {
return Optional.empty();
}
return Optional.of(Position.at(
spawn.getX(), spawn.getY(), spawn.getZ(),
player.getSpawnAngle(), 0,
angle, 0,
World.from(
player.getSpawnPointDimension().getValue().asString(),
UUID.nameUUIDFromBytes(player.getSpawnPointDimension().getValue().asString().getBytes())
world.getValue().asString(),
UUID.nameUUIDFromBytes(world.getValue().asString().getBytes())
),
plugin.getServerName()
));
@@ -152,7 +161,7 @@ public class FabricUser extends OnlineUser {
plugin.runSync(() -> {
player.stopRiding();
player.getPassengerList().forEach(Entity::stopRiding);
//#if MC==12104
//#if MC>=12104
player.teleport(
world, location.getX(), location.getY(), location.getZ(),
Set.of(),