Spire & ship fixes

This commit is contained in:
paulevsGitch 2021-01-14 22:00:20 +03:00
parent ff9e674587
commit 6d039875d2
3 changed files with 41 additions and 33 deletions

View file

@ -246,7 +246,7 @@ public class StructureHelper {
while (world.getBlockState(mut2).getMaterial().isReplaceable() && mut2.getY() > minY) {
mut2.setY(mut2.getY() - 1);
}
if (y > 50 && state.canPlaceAt(world, mut2)) {
if (!world.getBlockState(mut2).isAir() && state.canPlaceAt(world, mut2)) {
mut2.setY(mut2.getY() + 1);
BlocksHelper.setWithoutUpdate(world, mut2, state);
}

View file

@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@ -50,6 +51,9 @@ public class FloatingSpireFeature extends SpireFeature {
}
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getUnderMaterial();
}
return info.getState();
});
sdf.fillRecursive(world, center);

View file

@ -11,6 +11,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@ -32,7 +33,10 @@ public class SpireFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
pos = getPosOnSurfaceWG(world, pos);
if (pos.getY() > 57) {
if (pos.getY() < 10 || !world.getBlockState(pos.down(3)).isIn(EndTags.GEN_TERRAIN) || !world.getBlockState(pos.down(6)).isIn(EndTags.GEN_TERRAIN)) {
return false;
}
SDF sdf = new SDFSphere().setRadius(MHelper.randRange(2, 3, random)).setBlock(Blocks.END_STONE);
int count = MHelper.randRange(3, 7, random);
for (int i = 0; i < count; i++) {
@ -52,9 +56,11 @@ public class SpireFeature extends DefaultFeature {
}
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getUnderMaterial();
}
return info.getState();
});
sdf.fillRecursive(world, center);
}).fillRecursive(world, center);
support.forEach((bpos) -> {
if (EndBiomes.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
@ -64,8 +70,6 @@ public class SpireFeature extends DefaultFeature {
return true;
}
return false;
}
protected SDF addSegment(SDF sdf, float radius, Random random) {
SDF sphere = new SDFSphere().setRadius(radius).setBlock(Blocks.END_STONE);