Spire & ship fixes
This commit is contained in:
parent
ff9e674587
commit
6d039875d2
3 changed files with 41 additions and 33 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,39 +33,42 @@ 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) {
|
||||
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++) {
|
||||
float rMin = (i * 1.3F) + 2.5F;
|
||||
sdf = addSegment(sdf, MHelper.randRange(rMin, rMin + 1.5F, random), random);
|
||||
}
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||
sdf = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) (Math.abs(noise.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1)) * 3F + Math.abs(noise.eval(vec.getX() * 0.3, vec.getY() * 0.3 + 100, vec.getZ() * 0.3)) * 1.3F);
|
||||
}).setSource(sdf);
|
||||
final BlockPos center = pos;
|
||||
List<BlockPos> support = Lists.newArrayList();
|
||||
sdf.setReplaceFunction(REPLACE).addPostProcess((info) -> {
|
||||
if (info.getStateUp().isAir()) {
|
||||
if (random.nextInt(16) == 0) {
|
||||
support.add(info.getPos().up());
|
||||
}
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
}
|
||||
return info.getState();
|
||||
});
|
||||
sdf.fillRecursive(world, center);
|
||||
|
||||
support.forEach((bpos) -> {
|
||||
if (EndBiomes.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
EndFeatures.TENANEA_BUSH.getFeature().generate(world, chunkGenerator, random, bpos, null);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
if (pos.getY() < 10 || !world.getBlockState(pos.down(3)).isIn(EndTags.GEN_TERRAIN) || !world.getBlockState(pos.down(6)).isIn(EndTags.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
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++) {
|
||||
float rMin = (i * 1.3F) + 2.5F;
|
||||
sdf = addSegment(sdf, MHelper.randRange(rMin, rMin + 1.5F, random), random);
|
||||
}
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||
sdf = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) (Math.abs(noise.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1)) * 3F + Math.abs(noise.eval(vec.getX() * 0.3, vec.getY() * 0.3 + 100, vec.getZ() * 0.3)) * 1.3F);
|
||||
}).setSource(sdf);
|
||||
final BlockPos center = pos;
|
||||
List<BlockPos> support = Lists.newArrayList();
|
||||
sdf.setReplaceFunction(REPLACE).addPostProcess((info) -> {
|
||||
if (info.getStateUp().isAir()) {
|
||||
if (random.nextInt(16) == 0) {
|
||||
support.add(info.getPos().up());
|
||||
}
|
||||
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();
|
||||
}).fillRecursive(world, center);
|
||||
|
||||
support.forEach((bpos) -> {
|
||||
if (EndBiomes.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
EndFeatures.TENANEA_BUSH.getFeature().generate(world, chunkGenerator, random, bpos, null);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected SDF addSegment(SDF sdf, float radius, Random random) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue