gnembon / fabric-carpet

Fabric Carpet
MIT License
1.72k stars 276 forks source link

Fake player’s first login causes a lot of lag. #1438

Open xiaoyu2006 opened 2 years ago

xiaoyu2006 commented 2 years ago

When using /player someone spawn, if 'someone' has never logged in, in some circumstances it can freeze a tick.

My guess is the player’s GameProfile is not in the cache so the game will fetch the information. If the connection to Mojang’s server is lagging it can get stuck.

Ghoulboy78 commented 2 years ago

I suppose so, in which case I don't see how it can be fixed, because getting the GameProfile is obligatory for servers which aren't on offline mode... unless im mistaken?

xiaoyu2006 commented 2 years ago

in which case I don't see how it can be fixed

@Ghoulboy78 Maybe we can move the networking stuff into a separate thread. (It shouldn’t block the ticking thread from the very beginning.)

altrisi commented 2 years ago

Does a regular player logging in cause the same? (for the first time at least if you believe it's related to caching)

xiaoyu2006 commented 2 years ago

@altrisi The server is in offline mod so I have no idea whether this is the case.

mocksonline commented 2 years ago

@xiaoyu2006 直接修改GameProfile profile = new GameProfile(UUIDUtil.createOfflinePlayerUUID(playerName), playerName);就行了,正版验证部分注释掉就行

mocksonline commented 2 years ago

@xiaoyu2006 具体可以看我的fork See my fork for details https://github.com/mocksonline/fabric-carpet-force-offline-fakeplayer