From d3aac224ff641d86e936c382f979965064a6d0e3 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 5 May 2021 08:33:47 -0300 Subject: [PATCH] allow to spawn players when profile servers are down. --- .../java/carpet/patches/EntityPlayerMPFake.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index 3f7afd4662..b0cf86f3cd 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -18,6 +18,7 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerInteractionManager; import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.UserCache; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.GameMode; import net.minecraft.world.World; @@ -36,11 +37,15 @@ public static EntityPlayerMPFake createFake(String username, MinecraftServer ser //prolly half of that crap is not necessary, but it works ServerWorld worldIn = server.getWorld(dimensionId); ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn); - GameProfile gameprofile = server.getUserCache().findByName(username); - if (gameprofile == null) - { - return null; + UserCache.setUseRemote(false); + GameProfile gameprofile; + try { + gameprofile = server.getUserCache().findByName(username); + } + finally { + UserCache.setUseRemote(server.isDedicated() && server.isOnlineMode()); } + if (gameprofile == null) return null; if (gameprofile.getProperties().containsKey("textures")) { gameprofile = SkullBlockEntity.loadProperties(gameprofile);