schematic block light updates
This commit is contained in:
parent
3600cbaa1f
commit
226f4ba944
1 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@ import com.google.common.collect.HashBiMap;
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.server.world.ServerChunkManager;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
@ -142,16 +143,22 @@ public class RelativeBlockSample implements BlockView, ModifiableWorld {
|
||||||
BlockBox intersection = BlockBoxUtil.intersection(chunkBox, schemBox);
|
BlockBox intersection = BlockBoxUtil.intersection(chunkBox, schemBox);
|
||||||
if (!BlockBoxUtil.isRealBox(intersection)) return;
|
if (!BlockBoxUtil.isRealBox(intersection)) return;
|
||||||
|
|
||||||
|
ServerChunkManager serverChunkManager = world.getChunkManager();
|
||||||
|
|
||||||
|
|
||||||
BlockPos.stream(intersection).forEach(blockPos -> {
|
BlockPos.stream(intersection).forEach(blockPos -> {
|
||||||
if(chunk.getBlockState(blockPos).isAir()) {
|
if(chunk.getBlockState(blockPos).isAir()) {
|
||||||
BlockState newState = this.blockContainer.get(blockPos.subtract(origin));
|
BlockState newState = this.blockContainer.get(blockPos.subtract(origin));
|
||||||
if (!newState.isAir()) {
|
if (!newState.isAir()) {
|
||||||
chunk.setBlockState(blockPos, newState, false);
|
chunk.setBlockState(blockPos, newState, false);
|
||||||
if (blockUpdate) world.getChunkManager().markForUpdate(blockPos);
|
if (blockUpdate) serverChunkManager.markForUpdate(blockPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// do the lighting thing
|
||||||
|
serverChunkManager.getLightingProvider().light(chunk, false);
|
||||||
|
|
||||||
// TODO: depending on size of blockEntityContainer it might be faster to iterate over BlockPos.stream(intersection) instead
|
// TODO: depending on size of blockEntityContainer it might be faster to iterate over BlockPos.stream(intersection) instead
|
||||||
this.blockEntityContainer.forEach((blockPos, tag) -> {
|
this.blockEntityContainer.forEach((blockPos, tag) -> {
|
||||||
BlockPos actualPos = blockPos.add(origin);
|
BlockPos actualPos = blockPos.add(origin);
|
||||||
|
|
Loading…
Reference in a new issue