allow to spawn players when profile servers are down.
This commit is contained in:
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.ServerPlayerEntity;
|
||||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.UserCache;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
import net.minecraft.world.GameMode;
|
import net.minecraft.world.GameMode;
|
||||||
import net.minecraft.world.World;
|
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
|
//prolly half of that crap is not necessary, but it works
|
||||||
ServerWorld worldIn = server.getWorld(dimensionId);
|
ServerWorld worldIn = server.getWorld(dimensionId);
|
||||||
ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn);
|
ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn);
|
||||||
GameProfile gameprofile = server.getUserCache().findByName(username);
|
UserCache.setUseRemote(false);
|
||||||
if (gameprofile == null)
|
GameProfile gameprofile;
|
||||||
{
|
try {
|
||||||
return null;
|
gameprofile = server.getUserCache().findByName(username);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
UserCache.setUseRemote(server.isDedicated() && server.isOnlineMode());
|
||||||
|
}
|
||||||
|
if (gameprofile == null) return null;
|
||||||
if (gameprofile.getProperties().containsKey("textures"))
|
if (gameprofile.getProperties().containsKey("textures"))
|
||||||
{
|
{
|
||||||
gameprofile = SkullBlockEntity.loadProperties(gameprofile);
|
gameprofile = SkullBlockEntity.loadProperties(gameprofile);
|
||||||
|
|||||||
Reference in new issue
Block a user