Fabric 1.18

This commit is contained in:
Luck 2021-11-30 20:03:16 +00:00
parent 64bd8b5eaf
commit fa17404133
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
5 changed files with 10 additions and 50 deletions

View File

@ -14,9 +14,9 @@ repositories {
dependencies {
// https://modmuss50.me/fabric.html
minecraft 'com.mojang:minecraft:1.17.1'
mappings 'net.fabricmc:yarn:1.17.1+build.39:v2'
modImplementation 'net.fabricmc:fabric-loader:0.11.6'
minecraft 'com.mojang:minecraft:1.18'
mappings 'net.fabricmc:yarn:1.18+build.1:v2'
modImplementation 'net.fabricmc:fabric-loader:0.12.6'
Set<String> apiModules = [
'fabric-api-base',
@ -26,7 +26,7 @@ dependencies {
]
apiModules.forEach {
modImplementation(fabricApi.module(it, '0.38.0+1.17'))
modImplementation(fabricApi.module(it, '0.43.1+1.18'))
}
include(modImplementation('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))

View File

@ -81,7 +81,7 @@ public class FabricPlayerCalculator implements ContextCalculator<ServerPlayerEnt
}
// TODO: figure out dimension type context too
ServerWorld world = target.getServerWorld();
ServerWorld world = target.getWorld();
if (this.world) {
this.plugin.getConfiguration().get(ConfigKeys.WORLD_REWRITES).rewriteAndSubmit(getContextKey(world.getRegistryKey().getValue()), consumer);
}

View File

@ -1,39 +0,0 @@
/*
* This file is part of LuckPerms, licensed under the MIT License.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.fabric.mixin;
import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(ClientSettingsC2SPacket.class)
public interface ClientSettingsC2SPacketAccessor {
@Accessor("language")
String getLanguage();
}

View File

@ -70,7 +70,7 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
private Locale luckperms$locale;
// Used by PlayerChangeWorldCallback hook below.
@Shadow public abstract ServerWorld getServerWorld();
@Shadow public abstract ServerWorld getWorld();
@Override
public User getLuckPermsUser() {
@ -148,12 +148,12 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
@Inject(at = @At("HEAD"), method = "setClientSettings")
private void luckperms_setClientSettings(ClientSettingsC2SPacket information, CallbackInfo ci) {
String language = ((ClientSettingsC2SPacketAccessor) information).getLanguage();
String language = information.language();
this.luckperms$locale = TranslationManager.parseLocale(language);
}
@Inject(at = @At("TAIL"), method = "worldChanged")
private void luckperms_onChangeDimension(ServerWorld targetWorld, CallbackInfo ci) {
PlayerChangeWorldCallback.EVENT.invoker().onChangeWorld(this.getServerWorld(), targetWorld, (ServerPlayerEntity) (Object) this);
PlayerChangeWorldCallback.EVENT.invoker().onChangeWorld(this.getWorld(), targetWorld, (ServerPlayerEntity) (Object) this);
}
}

View File

@ -3,10 +3,9 @@
"package": "me.lucko.luckperms.fabric.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"ClientSettingsC2SPacketAccessor",
"CommandManagerMixin",
"ServerLoginNetworkHandlerAccessor",
"ServerPlayerEntityMixin",
"CommandManagerMixin"
"ServerPlayerEntityMixin"
],
"client": [
],