use of org.valkyrienskies.mod.mixin.accessors.client.world.ClientChunkManagerClientChunkMapAccessor in project Valkyrien-Skies-2 by ValkyrienSkies.
the class MixinClientChunkManager method preLoadChunkFromPacket.
@Inject(method = "loadChunkFromPacket", at = @At("HEAD"), cancellable = true)
private void preLoadChunkFromPacket(final int x, final int z, final BiomeArray biomes, final PacketByteBuf buf, final CompoundTag tag, final int verticalStripBitmask, final boolean complete, final CallbackInfoReturnable<WorldChunk> cir) {
final ClientChunkManagerClientChunkMapAccessor clientChunkMapAccessor = ClientChunkManagerClientChunkMapAccessor.class.cast(chunks);
if (!clientChunkMapAccessor.callIsInRadius(x, z)) {
if (ChunkAllocator.isChunkInShipyard(x, z)) {
final long chunkPosLong = ChunkPos.toLong(x, z);
final WorldChunk worldChunk = new WorldChunk(this.world, new ChunkPos(x, z), biomes);
worldChunk.loadFromPacket(biomes, buf, tag, verticalStripBitmask);
shipChunks.put(chunkPosLong, worldChunk);
final ChunkSection[] chunkSections = worldChunk.getSectionArray();
final LightingProvider lightingProvider = this.getLightingProvider();
lightingProvider.setColumnEnabled(new ChunkPos(x, z), true);
for (int j = 0; j < chunkSections.length; ++j) {
final ChunkSection chunkSection = chunkSections[j];
lightingProvider.setSectionStatus(ChunkSectionPos.from(x, j, z), ChunkSection.isEmpty(chunkSection));
}
this.world.resetChunkColor(x, z);
cir.setReturnValue(worldChunk);
}
}
}
Aggregations