Synchronize on public class to prevent obscure crashes in some cases

This commit is contained in:
embeddedt 2023-03-21 09:16:57 -04:00
parent 0f48165b15
commit a4e16704a3
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class BlockStateCacheHandler {
}
public static void rebuildParallel(boolean force) {
synchronized (BlockBehaviour.BlockStateBase.Cache.class) {
synchronized (BlockBehaviour.BlockStateBase.class) {
for (BlockState blockState : Block.BLOCK_STATE_REGISTRY) {
((IBlockState)blockState).clearCache();
}

View File

@ -37,7 +37,7 @@ public abstract class BlockStateBaseMixin implements IBlockState {
private BlockBehaviour.BlockStateBase.Cache initCacheIfNeeded(BlockBehaviour.BlockStateBase base) {
if(cacheInvalid) {
// Ensure that only one block's cache is built at a time
synchronized (BlockBehaviour.BlockStateBase.Cache.class) {
synchronized (BlockBehaviour.BlockStateBase.class) {
if(cacheInvalid) {
// Ensure that if we end up in here recursively, we just use the original cache
if(!buildingCache) {