Skip to content

Commit

Permalink
allow to spawn players when profile servers are down.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed May 5, 2021
1 parent dfb1435 commit d3aac22
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/carpet/patches/EntityPlayerMPFake.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit d3aac22

Please sign in to comment.