Fixes, structures, removed glow

This commit is contained in:
paulevsGitch 2020-11-09 00:03:48 +03:00
parent beab6ce10a
commit 687def43d1
15 changed files with 140 additions and 103 deletions

View file

@ -95,12 +95,12 @@ public abstract class NBTStructureFeature extends DefaultFeature {
structure.place(world, center, placementData, random);
TerrainMerge merge = getTerrainMerge(world, center, random);
int x1 = center.getX();
int z1 = center.getZ();
int x2 = x1 + offset.getX();
int z2 = z1 + offset.getZ();
if (merge != TerrainMerge.NONE) {
Mutable mut = new Mutable();
int x1 = center.getX();
int z1 = center.getZ();
int x2 = x1 + offset.getX();
int z2 = z1 + offset.getZ();
if (x2 < x1) {
int a = x1;
@ -119,10 +119,10 @@ public abstract class NBTStructureFeature extends DefaultFeature {
mut.setX(x);
for (int z = z1; z <= z2; z++) {
mut.setZ(z);
mut.setY(posY);
mut.setY(surfMax);
BlockState state = world.getBlockState(mut);
if (!state.isIn(EndTags.GEN_TERRAIN) && state.isSideSolidFullSquare(world, mut, Direction.DOWN)) {
for (int i = 0; i < 10; i--) {
for (int i = 0; i < 10; i++) {
mut.setY(mut.getY() - 1);
BlockState stateSt = world.getBlockState(mut);
if (!stateSt.isIn(EndTags.GEN_TERRAIN)) {
@ -153,6 +153,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
}
}
}
BlocksHelper.fixBlocks(world, new BlockPos(x1, center.getY(), z1), new BlockPos(x2, center.getY() + offset.getY(), z2));
return true;
}

View file

@ -31,14 +31,26 @@ public class DragonTreeBushFeature extends DefaultFeature {
if (world.getBlockState(pos.down()).getBlock() != EndBlocks.SHADOW_GRASS) return false;
BlockState leaves = EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1);
float radius = MHelper.randRange(1.8F, 4.5F, random);
float radius = MHelper.randRange(1.8F, 3.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return MHelper.randRange(-2F, 2F, random); }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.setPostProcess((info) -> {
if (info.getState().getBlock() instanceof LeavesBlock) {
int distance = info.getPos().getManhattanDistance(pos);
if (distance < 7) {
return info.getState().with(LeavesBlock.DISTANCE, distance);
}
else {
return AIR;
}
}
return info.getState();
});
sphere.fillRecursive(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.DRAGON_TREE.bark);
for (Direction d: Direction.values()) {