From 448a14f9b0fe386e244d4ed5730f7f1c8da07d86 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Wed, 26 Jan 2022 21:49:24 +0800 Subject: [PATCH] Fix create schematic cannon crash (#426 #447) --- .../mixin/core/world/level/chunk/LevelChunkMixin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/chunk/LevelChunkMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/chunk/LevelChunkMixin.java index abae4d8e..5a633753 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/chunk/LevelChunkMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/chunk/LevelChunkMixin.java @@ -3,6 +3,7 @@ package io.izzel.arclight.common.mixin.core.world.level.chunk; import io.izzel.arclight.common.bridge.core.world.WorldBridge; import io.izzel.arclight.common.bridge.core.world.chunk.ChunkAccessBridge; import io.izzel.arclight.common.bridge.core.world.chunk.ChunkBridge; +import io.izzel.arclight.common.mod.util.DistValidate; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; @@ -47,8 +48,10 @@ public abstract class LevelChunkMixin extends ChunkAccessMixin implements ChunkB @Inject(method = "(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/UpgradeData;Lnet/minecraft/world/ticks/LevelChunkTicks;Lnet/minecraft/world/ticks/LevelChunkTicks;J[Lnet/minecraft/world/level/chunk/LevelChunkSection;Lnet/minecraft/world/level/chunk/LevelChunk$PostLoadProcessor;Lnet/minecraft/world/level/levelgen/blending/BlendingData;)V", at = @At("RETURN")) private void arclight$init(Level worldIn, ChunkPos p_196855_, UpgradeData p_196856_, LevelChunkTicks p_196857_, LevelChunkTicks p_196858_, long p_196859_, @Nullable LevelChunkSection[] p_196860_, @Nullable LevelChunk.PostLoadProcessor p_196861_, @Nullable BlendingData p_196862_, CallbackInfo ci) { - this.$$level = ((ServerLevel) worldIn); - this.bukkitChunk = new CraftChunk((LevelChunk) (Object) this); + if (DistValidate.isValid(worldIn)) { + this.$$level = ((ServerLevel) worldIn); + this.bukkitChunk = new CraftChunk((LevelChunk) (Object) this); + } } @Inject(method = "(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ProtoChunk;Lnet/minecraft/world/level/chunk/LevelChunk$PostLoadProcessor;)V", at = @At("RETURN"))