- fix forest surface placing over water
This commit is contained in:
parent
3043540791
commit
0ca12bd0d1
2
Engine
2
Engine
@ -1 +1 @@
|
||||
Subproject commit 433db368f37a8f0a538d017610ce5cb11487d7fe
|
||||
Subproject commit 82bcd434921697fb51fd272d65ed6f10ec79ab22
|
@ -8,6 +8,7 @@ import me.dags.noise.Module;
|
||||
import me.dags.noise.Source;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
|
||||
public class ForestSurface implements Surface {
|
||||
|
||||
@ -19,8 +20,10 @@ public class ForestSurface implements Surface {
|
||||
|
||||
@Override
|
||||
public void buildSurface(int x, int z, int height, SurfaceContext ctx) {
|
||||
BlockState state = getMaterial(x, z);
|
||||
ctx.buffer.setBlockState(ctx.pos.setPos(x, height, z), state, false);
|
||||
if (ctx.buffer.getTopBlockY(Heightmap.Type.OCEAN_FLOOR_WG, x, z) == height) {
|
||||
BlockState state = getMaterial(x, z);
|
||||
ctx.buffer.setBlockState(ctx.pos.setPos(x, height, z), state, false);
|
||||
}
|
||||
}
|
||||
|
||||
private BlockState getMaterial(int x, int z) {
|
||||
|
@ -52,7 +52,7 @@ public class FreezeLayer extends Feature<NoFeatureConfig> {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean freeze(IWorld world, Biome biome, BlockPos top, BlockPos below, boolean force) {
|
||||
private boolean freeze(IWorld world, Biome biome, BlockPos.Mutable top, BlockPos below, boolean force) {
|
||||
boolean hasFrozen = false;
|
||||
if (biome.doesWaterFreeze(world, below, false)) {
|
||||
world.setBlockState(below, Blocks.ICE.getDefaultState(), 2);
|
||||
@ -62,9 +62,17 @@ public class FreezeLayer extends Feature<NoFeatureConfig> {
|
||||
if (force || biome.doesSnowGenerate(world, top)) {
|
||||
hasFrozen = true;
|
||||
world.setBlockState(top, Blocks.SNOW.getDefaultState(), 2);
|
||||
BlockState blockstate = world.getBlockState(below);
|
||||
if (blockstate.has(SnowyDirtBlock.SNOWY)) {
|
||||
world.setBlockState(below, blockstate.with(SnowyDirtBlock.SNOWY, true), 2);
|
||||
|
||||
// mark block below as snowy if supported
|
||||
BlockState stateUnder = world.getBlockState(below);
|
||||
if (stateUnder.has(SnowyDirtBlock.SNOWY)) {
|
||||
world.setBlockState(below, stateUnder.with(SnowyDirtBlock.SNOWY, true), 2);
|
||||
}
|
||||
|
||||
// remove floating blocks above
|
||||
top.move(Direction.UP, 1);
|
||||
if (!world.isAirBlock(top)) {
|
||||
world.setBlockState(top, Blocks.AIR.getDefaultState(), 2);
|
||||
}
|
||||
}
|
||||
return hasFrozen;
|
||||
|
Loading…
Reference in New Issue
Block a user