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

View File
Whitespace-only changes.
+2 -2
View File
@@ -1,7 +1,7 @@
essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.1+build.3:v2
fabric_loader_version=0.16.9
fabric_api_version=0.114.0+1.21.1
fabric_loader_version=0.16.10
fabric_api_version=0.115.4+1.21.1
fabric_permissions_api_version=0.3.1
fabric_adventure_platform_version=5.14.1
fabric_impactor_api_version=5.3.0
View File
Whitespace-only changes.
+1 -1
View File
@@ -3,6 +3,6 @@ essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.4+build.8:v2
fabric_loader_version=0.16.10
fabric_api_version=0.116.1+1.21.4
fabric_permissions_api_version=0.3.3
fabric_adventure_platform_version=6.2.0
fabric_adventure_platform_version=6.3.0
fabric_impactor_api_version=5.3.0
fabric_placeholder_api_version=2.5.2+1.21.3
+8
View File
@@ -0,0 +1,8 @@
essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.5+build.1:v2
fabric_loader_version=0.16.14
fabric_api_version=0.122.0+1.21.5
fabric_permissions_api_version=0.3.3
fabric_adventure_platform_version=6.4.0-SNAPSHOT
fabric_impactor_api_version=5.3.0
fabric_placeholder_api_version=2.6.3+1.21.5
+1 -1
View File
@@ -16,7 +16,7 @@ dependencies {
modImplementation include("me.lucko:fabric-permissions-api:${fabric_permissions_api_version}")
modImplementation include("eu.pb4:placeholder-api:${fabric_placeholder_api_version}")
modImplementation include("net.impactdev.impactor.api:economy:${fabric_impactor_api_version}")
modImplementation include("net.william278.toilet:toilet-fabric:1.0.12+$project.name")
modImplementation include("net.william278.toilet:toilet-fabric:1.0.13+$project.name")
modImplementation include("com.github.PokeSkies:FabricPluginMessaging:f621c4fcf6")
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
+1 -1
View File
@@ -1 +1 @@
1.21.4
1.21.5
+3 -1
View File
@@ -3,9 +3,11 @@ plugins {
}
preprocess {
def fabric12105 = createNode("1.21.5", 12105, "yarn")
def fabric12104 = createNode("1.21.4", 12104, "yarn")
def fabric12101 = createNode("1.21.1", 12101, "yarn")
strictExtraMappings.set(true)
fabric12101.link(fabric12104, null)
fabric12104.link(fabric12105, null)
fabric12101.link(fabric12105, null)
}
@@ -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(),