Fix crash if FerriteCore detection fails in neighbour table mixin

This commit is contained in:
embeddedt 2023-08-11 16:18:07 -04:00
parent 8b4c5d4c7a
commit 4d3aaceb9c
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -1,5 +1,7 @@
package org.embeddedt.modernfix.common.mixin.perf.mojang_registry_size;
import com.google.common.collect.ArrayTable;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Table;
import net.minecraft.world.level.block.state.StateHolder;
@ -23,7 +25,7 @@ public class StateHolderMixin {
/* optimize the case where block has no properties */
@Inject(method = "populateNeighbours", at = @At("RETURN"), require = 0)
private void replaceEmptyTable(CallbackInfo ci) {
if(this.neighbours.isEmpty())
if((this.neighbours instanceof ArrayTable || this.neighbours instanceof HashBasedTable) && this.neighbours.isEmpty())
this.neighbours = ImmutableTable.of();
}
}