mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:02:48 +01:00
Fix schematic init crash caused by updating null ChunkSections
This commit is contained in:
parent
2bedc94bc6
commit
b890204f44
2 changed files with 11 additions and 22 deletions
|
@ -1,10 +1,7 @@
|
|||
package com.simibubi.create.foundation.utility.worldWrappers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -12,29 +9,13 @@ import javax.annotation.Nullable;
|
|||
import com.simibubi.create.foundation.utility.worldWrappers.chunk.EmptierChunk;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunk;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeContainer;
|
||||
import net.minecraft.world.biome.BiomeRegistry;
|
||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.chunk.EmptyChunk;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.lighting.WorldLightManager;
|
||||
import net.minecraft.world.server.ChunkHolder;
|
||||
|
||||
public class WrappedChunkProvider extends AbstractChunkProvider {
|
||||
private PlacementSimulationWorld world;
|
||||
|
|
|
@ -21,11 +21,14 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.SectionPos;
|
||||
import net.minecraft.util.registry.DynamicRegistries;
|
||||
import net.minecraft.world.ITickList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkSection;
|
||||
import net.minecraft.world.lighting.WorldLightManager;
|
||||
import net.minecraft.world.storage.ISpawnWorldInfo;
|
||||
import net.minecraft.world.storage.MapData;
|
||||
|
@ -51,12 +54,12 @@ public class WrappedWorld extends World {
|
|||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WorldLightManager getLightingProvider() {
|
||||
return world.getLightingProvider();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(@Nullable BlockPos pos) {
|
||||
return world.getBlockState(pos);
|
||||
|
@ -84,7 +87,12 @@ public class WrappedWorld extends World {
|
|||
|
||||
@Override
|
||||
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
|
||||
world.notifyBlockUpdate(pos, oldState, newState, flags);
|
||||
Chunk chunk = world.getChunkProvider().getWorldChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||
if (chunk != null) {
|
||||
ChunkSection chunksection = chunk.getSections()[SectionPos.toChunk(pos.getY())];
|
||||
if (chunksection != null)
|
||||
world.notifyBlockUpdate(pos, oldState, newState, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue