Upgrade Fabric to MC 1.20.2

This commit is contained in:
Luck 2023-10-02 19:28:19 +01:00
parent f12d3cd8ba
commit 331a328771
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
6 changed files with 8 additions and 28 deletions

View File

@ -13,9 +13,9 @@ repositories {
dependencies {
// https://modmuss50.me/fabric.html
minecraft 'com.mojang:minecraft:1.20.1'
mappings 'net.fabricmc:yarn:1.20.1+build.2:v2'
modImplementation 'net.fabricmc:fabric-loader:0.14.21'
minecraft 'com.mojang:minecraft:1.20.2'
mappings 'net.fabricmc:yarn:1.20.2+build.2:v2'
modImplementation 'net.fabricmc:fabric-loader:0.14.22'
Set<String> apiModules = [
'fabric-api-base',
@ -25,7 +25,7 @@ dependencies {
]
apiModules.forEach {
modImplementation(fabricApi.module(it, '0.83.1+1.20.1'))
modImplementation(fabricApi.module(it, '0.89.3+1.20.2'))
}
include(modImplementation('me.lucko:fabric-permissions-api:0.2-SNAPSHOT'))

View File

@ -77,7 +77,8 @@ public class FabricSenderFactory extends SenderFactory<LPFabricPlugin, ServerCom
protected void sendMessage(ServerCommandSource sender, Component message) {
final Locale locale;
if (sender.getEntity() instanceof ServerPlayerEntity) {
locale = ((MixinUser) sender.getEntity()).getCachedLocale();
String language = ((ServerPlayerEntity) sender.getEntity()).getClientOptions().language();
locale = language == null ? null : TranslationManager.parseLocale(language);
} else {
locale = null;
}

View File

@ -68,7 +68,7 @@ public class FabricConnectionListener extends AbstractConnectionListener {
// Get their profile from the net handler - it should have been initialised by now.
GameProfile profile = ((ServerLoginNetworkHandlerAccessor) netHandler).getGameProfile();
UUID uniqueId = profile.isComplete() ? profile.getId() : Uuids.getOfflinePlayerUuid(profile.getName());
UUID uniqueId = profile.getId();
String username = profile.getName();
if (this.plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) {

View File

@ -28,7 +28,6 @@ package me.lucko.luckperms.fabric.mixin;
import me.lucko.luckperms.common.cacheddata.type.MetaCache;
import me.lucko.luckperms.common.cacheddata.type.PermissionCache;
import me.lucko.luckperms.common.context.manager.QueryOptionsCache;
import me.lucko.luckperms.common.locale.TranslationManager;
import me.lucko.luckperms.common.model.User;
import me.lucko.luckperms.common.verbose.event.CheckOrigin;
import me.lucko.luckperms.fabric.context.FabricContextManager;
@ -36,7 +35,6 @@ import me.lucko.luckperms.fabric.event.PlayerChangeWorldCallback;
import me.lucko.luckperms.fabric.model.MixinUser;
import net.luckperms.api.query.QueryOptions;
import net.luckperms.api.util.Tristate;
import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
@ -45,8 +43,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Locale;
/**
* Mixin into {@link ServerPlayerEntity} to store LP caches and implement {@link MixinUser}.
*
@ -65,9 +61,6 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
*/
private QueryOptionsCache<ServerPlayerEntity> luckperms$queryOptions;
// Cache player locale
private Locale luckperms$locale;
// Used by PlayerChangeWorldCallback hook below.
@Shadow public abstract ServerWorld getServerWorld();
@ -89,11 +82,6 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
return this.luckperms$queryOptions;
}
@Override
public Locale getCachedLocale() {
return this.luckperms$locale;
}
@Override
public void initializePermissions(User user) {
this.luckperms$user = user;
@ -172,13 +160,6 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
this.luckperms$user = oldMixin.getLuckPermsUser();
this.luckperms$queryOptions = oldMixin.getQueryOptionsCache();
this.luckperms$queryOptions.invalidate();
this.luckperms$locale = oldMixin.getCachedLocale();
}
@Inject(at = @At("HEAD"), method = "setClientSettings")
private void luckperms_setClientSettings(ClientSettingsC2SPacket information, CallbackInfo ci) {
String language = information.language();
this.luckperms$locale = TranslationManager.parseLocale(language);
}
@Inject(at = @At("TAIL"), method = "worldChanged")

View File

@ -52,8 +52,6 @@ public interface MixinUser {
*/
QueryOptionsCache<ServerPlayerEntity> getQueryOptionsCache(FabricContextManager contextManager);
Locale getCachedLocale();
/**
* Initialises permissions for this player using the given {@link User}.
*

View File

@ -2,7 +2,7 @@
shadow = "8.1.1"
blossom = "1.3.1"
forgegradle = "[6.0,6.2)"
loom = "1.2-SNAPSHOT"
loom = "1.3-SNAPSHOT"
licenser = "0.6.1"
[plugins]