Fix null biomes onChunkSave in 1.16

This commit is contained in:
James Seibel
2023-08-05 19:39:24 -05:00
parent 8bb1251dc9
commit 92ff5beebc
@@ -28,7 +28,17 @@ public class MixinChunkMap {
ServerLevel level;
@Inject(method = "save", at = @At(value = "INVOKE", target = CHUNK_SERIALIZER_WRITE))
private void onChunkSave(ChunkAccess chunk, CallbackInfoReturnable<Boolean> ci) {
private void onChunkSave(ChunkAccess chunk, CallbackInfoReturnable<Boolean> ci)
{
#if MC_1_16_5
if (chunk.getBiomes() == null)
{
// in 1.16.5 some chunks may be missing their biomes, which cause issues when attempting to save them
return;
}
#endif
ServerApi.INSTANCE.serverChunkSaveEvent(
new ChunkWrapper(chunk, level, ServerLevelWrapper.getWrapper(level)),
ServerLevelWrapper.getWrapper(level)