allow to spawn players when profile servers are down.

This commit is contained in:
gnembon committed 2021-05-05 08:33:47 -03:00
1 parent dfb1435e67
commit d3aac224ff
1 file changed
+9 -4
@@ -18,6 +18,7 @@ import net.minecraft.server.ServerTask;
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 class EntityPlayerMPFake extends ServerPlayerEntity
//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);