mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-01-24 12:44:56 +08:00
[fabric] Prevent NPEs getting client locale.
This commit is contained in:
parent
46d3b5caf6
commit
66047ade3d
@ -35,6 +35,7 @@
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -134,7 +135,7 @@ public void dispatchCUIEvent(CUIEvent event) {
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return Locale.forLanguageTag(((ExtendedPlayerEntity) this.player).getLanguage().replace("_", "-"));
|
||||
return TextUtils.getLocaleByMinecraftTag(((ExtendedPlayerEntity) this.player).getLanguage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,6 @@
|
||||
package com.sk89q.worldedit.fabric.mixin;
|
||||
|
||||
import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket;
|
||||
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
public abstract class MixinServerPlayerEntity extends PlayerEntity implements ExtendedPlayerEntity {
|
||||
|
||||
private String language;
|
||||
private String language = "en_us";
|
||||
|
||||
public MixinServerPlayerEntity(World world, BlockPos blockPos, GameProfile gameProfile) {
|
||||
super(world, blockPos, gameProfile);
|
||||
|
Loading…
Reference in New Issue
Block a user