Update core
This commit is contained in:
@@ -10,6 +10,7 @@ import com.seibel.lod.common.wrappers.block.BlockShapeWrapper;
|
||||
import com.seibel.lod.common.wrappers.world.BiomeWrapper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.QuartPos;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -32,25 +33,22 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
private final ChunkAccess chunk;
|
||||
private final BlockAndTintGetter lightSource;
|
||||
private final int CHUNK_SECTION_SHIFT = 4;
|
||||
private final int CHUNK_SECTION_MASK = 0b1111;
|
||||
private final int CHUNK_SIZE_SHIFT = 4;
|
||||
private final int CHUNK_SIZE_MASK = 0b1111;
|
||||
|
||||
@Override
|
||||
public int getHeight(){
|
||||
return chunk.getMaxBuildHeight();
|
||||
return chunk.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPositionInWater(int x, int y, int z)
|
||||
{
|
||||
BlockState blockState = chunk.getSections()[y >> CHUNK_SECTION_SHIFT].getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK);
|
||||
|
||||
//This type of block could be in water
|
||||
return blockState.getBlock() instanceof LiquidBlock // && !(blockState.getBlock() instanceof IWaterLoggable))
|
||||
|| (blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).isPresent() && blockState.getOptionalValue(BlockStateProperties.WATERLOGGED).get());
|
||||
}
|
||||
@Override
|
||||
public int getMinBuildHeight()
|
||||
{
|
||||
return chunk.getMinBuildHeight();
|
||||
}
|
||||
@Override
|
||||
public int getMaxBuildHeight()
|
||||
{
|
||||
return chunk.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeightMapValue(int xRel, int zRel)
|
||||
@@ -61,22 +59,23 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public IBiomeWrapper getBiome(int x, int y, int z)
|
||||
{
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome((x & CHUNK_SIZE_MASK) >> 2, y >> 2, (z & CHUNK_SIZE_MASK) >> 2));
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome(
|
||||
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockColorWrapper getBlockColorWrapper(int x, int y, int z)
|
||||
{
|
||||
Block block = chunk.getSections()[y >> CHUNK_SECTION_SHIFT].getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK).getBlock();
|
||||
BlockState blockState = chunk.getBlockState(new BlockPos(x,y,z));
|
||||
Block block = blockState.getBlock();
|
||||
return BlockColorWrapper.getBlockColorWrapper(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockShapeWrapper getBlockShapeWrapper(int x, int y, int z)
|
||||
{
|
||||
LevelChunkSection section = chunk.getSections()[y >> CHUNK_SECTION_SHIFT];
|
||||
if (section == null) return null;
|
||||
Block block = section.getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK).getBlock();
|
||||
BlockState blockState = chunk.getBlockState(new BlockPos(x,y,z));
|
||||
Block block = blockState.getBlock();
|
||||
return BlockShapeWrapper.getBlockShapeWrapper(block, this, x, y, z);
|
||||
}
|
||||
|
||||
@@ -154,9 +153,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
|
||||
public boolean isWaterLogged(int x, int y, int z)
|
||||
{
|
||||
LevelChunkSection section = chunk.getSections()[y >> CHUNK_SECTION_SHIFT];
|
||||
if (section == null) return false;
|
||||
BlockState blockState = section.getBlockState(x & CHUNK_SIZE_MASK, y & CHUNK_SECTION_MASK, z & CHUNK_SIZE_MASK);
|
||||
BlockState blockState = chunk.getBlockState(new BlockPos(x,y,z));
|
||||
|
||||
//This type of block is always in water
|
||||
return (!(blockState.getBlock() instanceof LiquidBlockContainer) && (blockState.getBlock() instanceof SimpleWaterloggedBlock))
|
||||
@@ -180,4 +177,5 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
if (lightSource == null) return -1;
|
||||
return lightSource.getBrightness(LightLayer.SKY, new BlockPos(x,y,z));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-5
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
import com.seibel.lod.core.api.ApiShared;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.api.ModAccessorApi;
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
@@ -536,14 +537,18 @@ public final class WorldGenerationStep {
|
||||
return;
|
||||
}
|
||||
int centreIndex = referencedChunks.size() / 2;
|
||||
|
||||
|
||||
// System.out.println("Lod Generate Event: "+event);
|
||||
for (int oy = -e.range; oy <= e.range; oy++) {
|
||||
for (int ox = -e.range; ox <= e.range; ox++) {
|
||||
for (int oy = -e.range; oy <= e.range; oy++)
|
||||
{
|
||||
for (int ox = -e.range; ox <= e.range; ox++)
|
||||
{
|
||||
int targetIndex = referencedChunks.offsetOf(centreIndex, ox, oy);
|
||||
ChunkAccess target = referencedChunks.get(targetIndex);
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, new ChunkWrapper(target, region),
|
||||
new LodBuilderConfig(generationMode), false);
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, new ChunkWrapper(target, region), new LodBuilderConfig(generationMode)
|
||||
, false);
|
||||
//params.lodBuilder.generateLodNodeAsync(new ChunkWrapper(target, region), ApiShared.lodWorld, params.lodDim.dimension,
|
||||
// generationMode, false, () -> {}, () -> {});
|
||||
}
|
||||
}
|
||||
e.pEvent.endNano = System.nanoTime();
|
||||
|
||||
+1
-1
Submodule core updated: 930113a6f9...22e47b9734
Reference in New Issue
Block a user