Don't reload all block shape caches on early init (mod compat)

Fixed https://github.com/ViaVersion/ViaFabricPlus/issues/245
This commit is contained in:
FlorianMichael 2023-09-18 22:15:05 +02:00
parent fe5cdf2c8c
commit 93bfa6a5ff
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -105,8 +105,10 @@ public class ClientsideFixes {
// Reloads some clientside stuff when the protocol version changes // Reloads some clientside stuff when the protocol version changes
ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> { ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
// Reloads all bounding boxes // Reloads all bounding boxes
for (Block block : RELOADABLE_BLOCKS) { if (MinecraftClient.getInstance() != null && MinecraftClient.getInstance().player != null) { // Make sure that the game is loaded when reloading the cache
block.getDefaultState().initShapeCache(); for (Block block : RELOADABLE_BLOCKS) {
block.getDefaultState().initShapeCache();
}
} }
// Calculates the current chat limit, since it changes depending on the protocol version // Calculates the current chat limit, since it changes depending on the protocol version