Continue migration
This commit is contained in:
parent
47ed597358
commit
33dbfbe633
263 changed files with 1450 additions and 1486 deletions
|
@ -3,11 +3,11 @@ package ru.betterend.world.features.terrain;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -19,8 +19,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
int maxY = pos.getY() + BlocksHelper.upRay(world, pos, 16);
|
||||
int minY = pos.getY() - BlocksHelper.downRay(world, pos, 16);
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import net.minecraft.world.level.material.Material;
|
|||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -24,8 +24,8 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
double radius = MHelper.randRange(10.0, 20.0, random);
|
||||
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
||||
int dist = MHelper.floor(radius);
|
||||
|
@ -121,7 +121,7 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
}
|
||||
pos = POS.below();
|
||||
if (world.getBlockState(pos).isIn(EndTags.GEN_TERRAIN)) {
|
||||
state = world.getBiome(pos).getGenerationSettings().getSurfaceConfig()
|
||||
state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
if (y > waterLevel + 1)
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state);
|
||||
|
@ -183,7 +183,8 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
// Make border
|
||||
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
|
||||
if (world.isAir(POS.up())) {
|
||||
state = world.getBiome(POS).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
state = world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
BlocksHelper.setWithoutUpdate(world, POS,
|
||||
random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.defaultBlockState());
|
||||
BlocksHelper.setWithoutUpdate(world, POS.below(), END_STONE);
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -23,8 +23,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class FallenPillarFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.down(5)).isIn(EndTags.GEN_TERRAIN)) {
|
||||
|
@ -38,7 +38,7 @@ public class FallenPillarFeature extends DefaultFeature {
|
|||
pillar = new SDFTranslate().setTranslate(0, radius * 0.5F - 2, 0).setSource(pillar);
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||
pillar = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) (noise.eval(vec.getX() * 0.3, vec.getY() * 0.3, vec.getZ() * 0.3) * 0.5F);
|
||||
return (float) (noise.eval(vec.x() * 0.3, vec.y() * 0.3, vec.z() * 0.3) * 0.5F);
|
||||
}).setSource(pillar);
|
||||
Vector3f vec = MHelper.randomHorizontal(random);
|
||||
float angle = (float) random.nextGaussian() * 0.05F + (float) Math.PI;
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.google.common.collect.Lists;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
@ -21,8 +21,8 @@ import ru.betterend.util.sdf.primitive.SDFSphere;
|
|||
|
||||
public class FloatingSpireFeature extends SpireFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
int minY = getYOnSurface(world, pos.getX(), pos.getZ());
|
||||
int y = minY > 57 ? MHelper.floor(MHelper.randRange(minY, minY * 2, random) * 0.5F + 32)
|
||||
: MHelper.randRange(64, 192, random);
|
||||
|
@ -42,8 +42,8 @@ public class FloatingSpireFeature extends SpireFeature {
|
|||
|
||||
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);
|
||||
return (float) (Math.abs(noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1)) * 3F
|
||||
+ Math.abs(noise.eval(vec.x() * 0.3, vec.y() * 0.3 + 100, vec.z() * 0.3)) * 1.3F);
|
||||
}).setSource(sdf);
|
||||
final BlockPos center = pos;
|
||||
List<BlockPos> support = Lists.newArrayList();
|
||||
|
@ -52,9 +52,10 @@ public class FloatingSpireFeature extends SpireFeature {
|
|||
if (random.nextInt(16) == 0) {
|
||||
support.add(info.getPos().up());
|
||||
}
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
} else if (info.getState(Direction.UP, 3).isAir()) {
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getUnderMaterial();
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getUnderMaterial();
|
||||
}
|
||||
return info.getState();
|
||||
});
|
||||
|
@ -62,7 +63,7 @@ public class FloatingSpireFeature extends SpireFeature {
|
|||
|
||||
support.forEach((bpos) -> {
|
||||
if (EndBiomes.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||
EndFeatures.TENANEA_BUSH.getFeature().generate(world, chunkGenerator, random, bpos, null);
|
||||
EndFeatures.TENANEA_BUSH.getFeature().place(world, chunkGenerator, random, bpos, null);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.HorizontalFacingBlock;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.HydrothermalVentBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -45,8 +45,8 @@ public class GeyserFeature extends DefaultFeature {
|
|||
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
|
||||
if (pos.getY() < 10) {
|
||||
|
@ -96,9 +96,9 @@ public class GeyserFeature extends DefaultFeature {
|
|||
final OpenSimplexNoise noise2 = new OpenSimplexNoise(random.nextLong());
|
||||
|
||||
bowl = new SDFCoordModify().setFunction((vec) -> {
|
||||
float dx = (float) noise1.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1);
|
||||
float dz = (float) noise2.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1);
|
||||
vec.set(vec.getX() + dx, vec.getY(), vec.getZ() + dz);
|
||||
float dx = (float) noise1.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1);
|
||||
float dz = (float) noise2.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1);
|
||||
vec.set(vec.x() + dx, vec.y(), vec.z() + dz);
|
||||
}).setSource(bowl);
|
||||
|
||||
SDF cut = new SDFFlatland().setBlock(Blocks.AIR);
|
||||
|
@ -124,13 +124,13 @@ public class GeyserFeature extends DefaultFeature {
|
|||
obj1 = new SDFCappedCone().setHeight(halfHeight + 5).setRadius1(radius1 * 0.5F).setRadius2(radius2);
|
||||
sdf = new SDFTranslate().setTranslate(0, halfHeight - 13, 0).setSource(obj1);
|
||||
sdf = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.3F, vec.getY() * 0.3F, vec.getZ() * 0.3F) * 0.5F;
|
||||
return (float) noise.eval(vec.x() * 0.3F, vec.y() * 0.3F, vec.z() * 0.3F) * 0.5F;
|
||||
}).setSource(sdf);
|
||||
|
||||
obj2 = new SDFSphere().setRadius(radius1);
|
||||
SDF cave = new SDFScale3D().setScale(1.5F, 1, 1.5F).setSource(obj2);
|
||||
cave = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.1F, vec.getY() * 0.1F, vec.getZ() * 0.1F) * 2F;
|
||||
return (float) noise.eval(vec.x() * 0.1F, vec.y() * 0.1F, vec.z() * 0.1F) * 2F;
|
||||
}).setSource(cave);
|
||||
cave = new SDFTranslate().setTranslate(0, -halfHeight - 10, 0).setSource(cave);
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class GeyserFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
EndFeatures.SULPHURIC_LAKE.getFeature().generate(world, chunkGenerator, random, pos, null);
|
||||
EndFeatures.SULPHURIC_LAKE.getFeature().place(world, chunkGenerator, random, pos, null);
|
||||
|
||||
double distance = radius1 * 1.7;
|
||||
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.sdf.SDF;
|
||||
|
@ -33,8 +33,8 @@ public class IceStarFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
float size = MHelper.randRange(minSize, maxSize, random);
|
||||
int count = MHelper.randRange(minCount, maxCount, random);
|
||||
List<Vector3f> points = getFibonacciPoints(count);
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -21,8 +21,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class ObsidianBoulderFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below()).isIn(EndTags.END_GROUND)) {
|
||||
|
@ -39,7 +39,7 @@ public class ObsidianBoulderFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void makeBoulder(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
private void makeBoulder(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
if (!world.getBlockState(pos.below()).isIn(EndTags.END_GROUND)) {
|
||||
return;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class ObsidianBoulderFeature extends DefaultFeature {
|
|||
sphere = new SDFScale3D().setScale(sx, sy, sz).setSource(sphere);
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) (noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 1.5F);
|
||||
return (float) (noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 1.5F);
|
||||
}).setSource(sphere);
|
||||
|
||||
BlockState mossy = EndBlocks.MOSSY_OBSIDIAN.defaultBlockState();
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -25,8 +25,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class ObsidianPillarBasementFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.down(5)).isIn(EndTags.GEN_TERRAIN)) {
|
||||
|
@ -41,7 +41,7 @@ public class ObsidianPillarBasementFeature extends DefaultFeature {
|
|||
SDF cut = new SDFFlatland().setBlock(Blocks.OBSIDIAN);
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
|
||||
cut = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) (noise.eval(vec.getX() * 0.2, vec.getZ() * 0.2) * 3);
|
||||
return (float) (noise.eval(vec.x() * 0.2, vec.z() * 0.2) * 3);
|
||||
}).setSource(cut);
|
||||
Vector3f vec = MHelper.randomHorizontal(random);
|
||||
float angle = random.nextFloat() * 0.5F + (float) Math.PI;
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.sdf.SDF;
|
||||
|
@ -35,8 +35,8 @@ public class OreLayerFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
float radius = this.radius * 0.5F;
|
||||
int r = MHelper.floor(radius + 1);
|
||||
int posX = MHelper.randRange(Math.max(r - 16, 0), Math.min(31 - r, 15), random) + pos.getX();
|
||||
|
@ -49,10 +49,10 @@ public class OreLayerFeature extends DefaultFeature {
|
|||
|
||||
SPHERE.setRadius(radius).setBlock(state);
|
||||
NOISE.setFunction((vec) -> {
|
||||
double x = (vec.getX() + pos.getX()) * 0.1;
|
||||
double z = (vec.getZ() + pos.getZ()) * 0.1;
|
||||
double x = (vec.x() + pos.getX()) * 0.1;
|
||||
double z = (vec.z() + pos.getZ()) * 0.1;
|
||||
double offset = noise.eval(x, z);
|
||||
vec.set(vec.getX(), vec.getY() + (float) offset * 8, vec.getZ());
|
||||
vec.set(vec.x(), vec.y() + (float) offset * 8, vec.z());
|
||||
});
|
||||
FUNCTION.fillRecursive(world, new BlockPos(posX, posY, posZ));
|
||||
return true;
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
@ -21,8 +21,8 @@ public class SingleBlockFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).isIn(EndTags.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -17,8 +17,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).isIn(EndTags.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@ import com.google.common.collect.Lists;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
@ -31,11 +31,11 @@ public class SpireFeature extends DefaultFeature {
|
|||
protected static final Function<BlockState, Boolean> REPLACE;
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
if (pos.getY() < 10 || !world.getBlockState(pos.down(3)).isIn(EndTags.GEN_TERRAIN)
|
||||
|| !world.getBlockState(pos.down(6)).isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(EndTags.GEN_TERRAIN)
|
||||
|| !world.getBlockState(pos.below(6)).is(EndTags.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -46,27 +46,28 @@ public class SpireFeature extends DefaultFeature {
|
|||
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);
|
||||
sdf = new SDFDisplacement().setFunction(vec -> {
|
||||
return (float) (Math.abs(noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1)) * 3F
|
||||
+ Math.abs(noise.eval(vec.x() * 0.3, vec.y() * 0.3 + 100, vec.z() * 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());
|
||||
support.add(info.getPos().above());
|
||||
}
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
} else if (info.getState(Direction.UP, 3).isAir()) {
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceConfig().getUnderMaterial();
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.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);
|
||||
EndFeatures.TENANEA_BUSH.getFeature().place(world, chunkGenerator, random, bpos, null);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class SpireFeature extends DefaultFeature {
|
|||
|
||||
static {
|
||||
REPLACE = (state) -> {
|
||||
if (state.isIn(EndTags.END_GROUND)) {
|
||||
if (state.is(EndTags.END_GROUND)) {
|
||||
return true;
|
||||
}
|
||||
if (state.getBlock() instanceof LeavesBlock) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import net.minecraft.state.property.Properties;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.basis.StalactiteBlock;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -28,8 +28,8 @@ public class StalactiteFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!isGround(world.getBlockState(ceiling ? pos.up() : pos.below()).getBlock())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -19,8 +19,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class SulphurHillFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
if (pos.getY() < 57 || pos.getY() > 70) {
|
||||
return false;
|
||||
|
@ -40,7 +40,7 @@ public class SulphurHillFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void makeCircle(StructureWorldAccess world, BlockPos pos, OpenSimplexNoise noise, Random random) {
|
||||
private void makeCircle(WorldGenLevel world, BlockPos pos, OpenSimplexNoise noise, Random random) {
|
||||
int radius = MHelper.randRange(5, 9, random);
|
||||
int min = -radius - 3;
|
||||
int max = radius + 4;
|
||||
|
|
|
@ -13,9 +13,9 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.SulphurCrystalBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
@ -31,8 +31,8 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
int radius = MHelper.randRange(10, 30, random);
|
||||
|
||||
int top = world.getTopY(Heightmap.Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
|
@ -106,7 +106,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
double v = noise.eval(x * 0.1, y * 0.1, z * 0.1)
|
||||
+ noise.eval(x * 0.03, y * 0.03, z * 0.03) * 0.5;
|
||||
if (v > 0.4) {
|
||||
brimstone.add(mut.toImmutable());
|
||||
brimstone.add(mut.immutable());
|
||||
} else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, rock);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
|| state.getMaterial().equals(Material.UNDERWATER_PLANT) || state.getMaterial().equals(Material.LEAVES);
|
||||
}
|
||||
|
||||
private void placeBrimstone(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
private void placeBrimstone(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
BlockState state = getBrimstone(world, pos);
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state);
|
||||
if (state.getValue(BlockProperties.ACTIVE)) {
|
||||
|
@ -181,7 +181,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private BlockState getBrimstone(StructureWorldAccess world, BlockPos pos) {
|
||||
private BlockState getBrimstone(WorldGenLevel world, BlockPos pos) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (world.getBlockState(pos.relative(dir)).is(Blocks.WATER)) {
|
||||
return EndBlocks.BRIMSTONE.defaultBlockState().with(BlockProperties.ACTIVE, true);
|
||||
|
@ -190,7 +190,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
return EndBlocks.BRIMSTONE.defaultBlockState();
|
||||
}
|
||||
|
||||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
private void makeShards(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
BlockPos side;
|
||||
if (random.nextInt(16) == 0 && world.getBlockState((side = pos.relative(dir))).is(Blocks.WATER)) {
|
||||
|
|
|
@ -7,13 +7,13 @@ import com.google.common.collect.Sets;
|
|||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.SulphurCrystalBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
@ -28,8 +28,8 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
blockPos = getPosOnSurfaceWG(world, blockPos);
|
||||
|
||||
if (blockPos.getY() < 57) {
|
||||
|
@ -63,7 +63,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
if (world.getBlockState(POS).isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (isBorder(world, POS)) {
|
||||
if (random.nextInt(8) > 0) {
|
||||
brimstone.add(POS.toImmutable());
|
||||
brimstone.add(POS.immutable());
|
||||
if (random.nextBoolean()) {
|
||||
brimstone.add(POS.below());
|
||||
if (random.nextBoolean()) {
|
||||
|
@ -82,7 +82,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
brimstone.add(POS.toImmutable());
|
||||
brimstone.add(POS.immutable());
|
||||
if (random.nextBoolean()) {
|
||||
brimstone.add(POS.below());
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
} else if (dist < r2) {
|
||||
POS.setY(getYOnSurface(world, x, z) - 1);
|
||||
if (world.getBlockState(POS).isIn(EndTags.GEN_TERRAIN)) {
|
||||
brimstone.add(POS.toImmutable());
|
||||
brimstone.add(POS.immutable());
|
||||
if (random.nextBoolean()) {
|
||||
brimstone.add(POS.below());
|
||||
if (random.nextBoolean()) {
|
||||
|
@ -138,7 +138,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean isBorder(StructureWorldAccess world, BlockPos pos) {
|
||||
private boolean isBorder(WorldGenLevel world, BlockPos pos) {
|
||||
int y = pos.getY() + 1;
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (getYOnSurface(world, pos.getX() + dir.getOffsetX(), pos.getZ() + dir.getOffsetZ()) < y) {
|
||||
|
@ -148,7 +148,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean isAbsoluteBorder(StructureWorldAccess world, BlockPos pos) {
|
||||
private boolean isAbsoluteBorder(WorldGenLevel world, BlockPos pos) {
|
||||
int y = pos.getY() - 2;
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (getYOnSurface(world, pos.getX() + dir.getOffsetX() * 3, pos.getZ() + dir.getOffsetZ() * 3) < y) {
|
||||
|
@ -158,7 +158,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean isDeepWater(StructureWorldAccess world, BlockPos pos) {
|
||||
private boolean isDeepWater(WorldGenLevel world, BlockPos pos) {
|
||||
int y = pos.getY() + 1;
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (getYOnSurface(world, pos.getX() + dir.getOffsetX(), pos.getZ() + dir.getOffsetZ()) < y
|
||||
|
@ -170,7 +170,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void placeBrimstone(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
private void placeBrimstone(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
BlockState state = getBrimstone(world, pos);
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state);
|
||||
if (state.getValue(BlockProperties.ACTIVE)) {
|
||||
|
@ -178,7 +178,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private BlockState getBrimstone(StructureWorldAccess world, BlockPos pos) {
|
||||
private BlockState getBrimstone(WorldGenLevel world, BlockPos pos) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (world.getBlockState(pos.relative(dir)).is(Blocks.WATER)) {
|
||||
return EndBlocks.BRIMSTONE.defaultBlockState().with(BlockProperties.ACTIVE, true);
|
||||
|
@ -187,7 +187,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
return EndBlocks.BRIMSTONE.defaultBlockState();
|
||||
}
|
||||
|
||||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
private void makeShards(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
BlockPos side;
|
||||
if (random.nextInt(16) == 0 && world.getBlockState((side = pos.relative(dir))).is(Blocks.WATER)) {
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.HydrothermalVentBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -17,8 +17,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class SurfaceVentFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.down(3)).isIn(EndTags.GEN_TERRAIN)) {
|
||||
|
|
|
@ -10,11 +10,11 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
@ -28,8 +28,8 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
Set<BlockPos> floorPositions = Sets.newHashSet();
|
||||
Set<BlockPos> ceilPositions = Sets.newHashSet();
|
||||
int sx = (pos.getX() >> 4) << 4;
|
||||
|
@ -38,7 +38,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
MutableBlockPos max = new MutableBlockPos().set(pos);
|
||||
fillSets(sx, sz, world.getChunk(pos), floorPositions, ceilPositions, min, max);
|
||||
EndCaveBiome biome = supplier.get();
|
||||
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||
placeCeil(world, biome, ceilPositions, random);
|
||||
BlocksHelper.fixBlocks(world, min, max);
|
||||
|
@ -63,12 +63,12 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
BlockState bottom = chunk.getBlockState(mut2);
|
||||
if (top.isAir() && (bottom.isIn(EndTags.GEN_TERRAIN) || bottom.is(Blocks.STONE))) {
|
||||
mut3.set(mut2).move(sx, 0, sz);
|
||||
floorPositions.add(mut3.toImmutable());
|
||||
floorPositions.add(mut3.immutable());
|
||||
updateMin(mut3, min);
|
||||
updateMax(mut3, max);
|
||||
} else if (bottom.isAir() && (top.isIn(EndTags.GEN_TERRAIN) || top.is(Blocks.STONE))) {
|
||||
mut3.set(mut).move(sx, 0, sz);
|
||||
ceilPositions.add(mut3.toImmutable());
|
||||
ceilPositions.add(mut3.immutable());
|
||||
updateMin(mut3, min);
|
||||
updateMax(mut3, max);
|
||||
}
|
||||
|
@ -102,22 +102,21 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
protected void placeFloor(StructureWorldAccess world, EndCaveBiome biome, Set<BlockPos> floorPositions,
|
||||
Random random, BlockState surfaceBlock) {
|
||||
protected void placeFloor(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> floorPositions, Random random,
|
||||
BlockState surfaceBlock) {
|
||||
float density = biome.getFloorDensity();
|
||||
floorPositions.forEach((pos) -> {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
||||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.generate(world, null, random, pos.up(), null);
|
||||
feature.place(world, null, random, pos.up(), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void placeCeil(StructureWorldAccess world, EndCaveBiome biome, Set<BlockPos> ceilPositions,
|
||||
Random random) {
|
||||
protected void placeCeil(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> ceilPositions, Random random) {
|
||||
float density = biome.getCeilDensity();
|
||||
ceilPositions.forEach((pos) -> {
|
||||
BlockState ceilBlock = biome.getCeil(pos);
|
||||
|
@ -127,7 +126,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.generate(world, null, random, pos.below(), null);
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,11 +11,11 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import ru.betterend.interfaces.IBiomeArray;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -32,8 +32,8 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
protected static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
DefaultFeatureConfig config) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!(GeneratorOptions.useNewGenerator() && GeneratorOptions.noRingVoid())
|
||||
|| pos.getX() * pos.getX() + pos.getZ() * pos.getZ() <= 22500) {
|
||||
return false;
|
||||
|
@ -63,15 +63,16 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
if (world.getBlockState(mut).getMaterial().isReplaceable()) {
|
||||
mut.setY(bpos.getY() - 1);
|
||||
if (world.getBlockState(mut).isIn(EndTags.GEN_TERRAIN)) {
|
||||
floorPositions.add(mut.toImmutable());
|
||||
floorPositions.add(mut.immutable());
|
||||
}
|
||||
mut.setY(bpos.getY() + 1);
|
||||
if (world.getBlockState(mut).isIn(EndTags.GEN_TERRAIN)) {
|
||||
ceilPositions.add(mut.toImmutable());
|
||||
ceilPositions.add(mut.immutable());
|
||||
}
|
||||
}
|
||||
});
|
||||
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||
placeCeil(world, biome, ceilPositions, random);
|
||||
}
|
||||
|
@ -81,24 +82,23 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected abstract Set<BlockPos> generate(StructureWorldAccess world, BlockPos center, int radius, Random random);
|
||||
protected abstract Set<BlockPos> place(WorldGenLevel world, BlockPos center, int radius, Random random);
|
||||
|
||||
protected void placeFloor(StructureWorldAccess world, EndCaveBiome biome, Set<BlockPos> floorPositions,
|
||||
Random random, BlockState surfaceBlock) {
|
||||
protected void placeFloor(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> floorPositions, Random random,
|
||||
BlockState surfaceBlock) {
|
||||
float density = biome.getFloorDensity();
|
||||
floorPositions.forEach((pos) -> {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
||||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.generate(world, null, random, pos.up(), null);
|
||||
feature.place(world, null, random, pos.up(), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void placeCeil(StructureWorldAccess world, EndCaveBiome biome, Set<BlockPos> ceilPositions,
|
||||
Random random) {
|
||||
protected void placeCeil(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> ceilPositions, Random random) {
|
||||
float density = biome.getCeilDensity();
|
||||
ceilPositions.forEach((pos) -> {
|
||||
BlockState ceilBlock = biome.getCeil(pos);
|
||||
|
@ -108,24 +108,24 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.generate(world, null, random, pos.below(), null);
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setBiomes(StructureWorldAccess world, EndCaveBiome biome, Set<BlockPos> blocks) {
|
||||
protected void setBiomes(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> blocks) {
|
||||
blocks.forEach((pos) -> setBiome(world, pos, biome));
|
||||
}
|
||||
|
||||
private void setBiome(StructureWorldAccess world, BlockPos pos, EndCaveBiome biome) {
|
||||
private void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
|
||||
IBiomeArray array = (IBiomeArray) world.getChunk(pos).getBiomeArray();
|
||||
if (array != null) {
|
||||
array.setBiome(biome.getActualBiome(), pos);
|
||||
}
|
||||
}
|
||||
|
||||
private BlockPos findPos(StructureWorldAccess world, BlockPos pos, int radius, Random random) {
|
||||
private BlockPos findPos(WorldGenLevel world, BlockPos pos, int radius, Random random) {
|
||||
int top = world.getTopY(Heightmap.Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
MutableBlockPos bpos = new MutableBlockPos();
|
||||
bpos.setX(pos.getX());
|
||||
|
@ -155,7 +155,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
return new BlockPos(pos.getX(), MHelper.randRange(bottom, top, random), pos.getZ());
|
||||
}
|
||||
|
||||
private void fixBlocks(StructureWorldAccess world, Set<BlockPos> caveBlocks) {
|
||||
private void fixBlocks(WorldGenLevel world, Set<BlockPos> caveBlocks) {
|
||||
BlockPos pos = caveBlocks.iterator().next();
|
||||
MutableBlockPos start = new MutableBlockPos().set(pos);
|
||||
MutableBlockPos end = new MutableBlockPos().set(pos);
|
||||
|
@ -184,7 +184,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
BlocksHelper.fixBlocks(world, start.add(-5, -5, -5), end.add(5, 5, 5));
|
||||
}
|
||||
|
||||
protected boolean isWaterNear(StructureWorldAccess world, BlockPos pos) {
|
||||
protected boolean isWaterNear(WorldGenLevel world, BlockPos pos) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (!world.getFluidState(pos.relative(dir, 5)).isEmpty()) {
|
||||
return true;
|
||||
|
@ -193,7 +193,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected boolean biomeMissingCaves(StructureWorldAccess world, BlockPos pos) {
|
||||
protected boolean biomeMissingCaves(WorldGenLevel world, BlockPos pos) {
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
Biome biome = world.getBiome(pos.offset(x << 4, 0, z << 4));
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -17,7 +17,7 @@ import ru.betterend.util.MHelper;
|
|||
|
||||
public class RoundCaveFeature extends EndCaveFeature {
|
||||
@Override
|
||||
protected Set<BlockPos> generate(StructureWorldAccess world, BlockPos center, int radius, Random random) {
|
||||
protected Set<BlockPos> place(WorldGenLevel world, BlockPos center, int radius, Random random) {
|
||||
OpenSimplexNoise noise = new OpenSimplexNoise(MHelper.getSeed(534, center.getX(), center.getZ()));
|
||||
|
||||
int x1 = center.getX() - radius - 5;
|
||||
|
@ -52,7 +52,7 @@ public class RoundCaveFeature extends EndCaveFeature {
|
|||
state = world.getBlockState(bpos);
|
||||
if (isReplaceable(state) && !isWaterNear(world, bpos)) {
|
||||
BlocksHelper.setWithoutUpdate(world, bpos, CAVE_AIR);
|
||||
blocks.add(bpos.toImmutable());
|
||||
blocks.add(bpos.immutable());
|
||||
|
||||
while (state.getMaterial().equals(Material.LEAVES)) {
|
||||
BlocksHelper.setWithoutUpdate(world, bpos, CAVE_AIR);
|
||||
|
|
|
@ -8,10 +8,10 @@ import java.util.function.Function;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.SplineHelper;
|
||||
|
@ -21,7 +21,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
||||
@Override
|
||||
protected Set<BlockPos> generate(StructureWorldAccess world, BlockPos center, int radius, Random random) {
|
||||
protected Set<BlockPos> place(WorldGenLevel world, BlockPos center, int radius, Random random) {
|
||||
// OpenSimplexNoise noise = new OpenSimplexNoise(MHelper.getSeed(534,
|
||||
// center.getX(), center.getZ()));
|
||||
float rad = radius * 0.15F;
|
||||
|
@ -31,9 +31,9 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
spline = SplineHelper.smoothSpline(spline, 5);
|
||||
SplineHelper.offsetParts(spline, random, 5, radius * 0.4F, 5);
|
||||
for (Vector3f vec : spline) {
|
||||
float x = Mth.clamp(vec.getX(), min, max);
|
||||
float y = Mth.clamp(vec.getY(), -radius, radius);
|
||||
float z = Mth.clamp(vec.getZ(), min, max);
|
||||
float x = Mth.clamp(vec.x(), min, max);
|
||||
float y = Mth.clamp(vec.y(), -radius, radius);
|
||||
float z = Mth.clamp(vec.z(), min, max);
|
||||
vec.set(x, y, z);
|
||||
}
|
||||
SDF sdf = SplineHelper.buildSDF(spline, rad, rad, (vec) -> Blocks.AIR.defaultBlockState());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue