Various smaller updates
This commit is contained in:
parent
fdd61262c5
commit
10a9a81725
64 changed files with 372 additions and 276 deletions
|
@ -31,8 +31,8 @@ public class BiomeIslandFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
Biome biome = world.getBiome(pos);
|
||||
SurfaceBuilderConfiguration surfaceConfig = biome.getGenerationSettings().getSurfaceBuilderConfig();
|
||||
BlockState topMaterial = surfaceConfig.getTopMaterial();
|
||||
|
|
|
@ -16,9 +16,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class CavePumpkinFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.above()).is(TagAPI.GEN_TERRAIN) || !world.isEmptyBlock(pos)
|
||||
|| !world.isEmptyBlock(pos.below())) {
|
||||
return false;
|
||||
|
|
|
@ -77,9 +77,9 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
center = new BlockPos(((center.getX() >> 4) << 4) | 8, 128, ((center.getZ() >> 4) << 4) | 8);
|
||||
center = getGround(world, center);
|
||||
BoundingBox bounds = makeBox(center);
|
||||
|
|
|
@ -28,9 +28,9 @@ public abstract class FullHeightScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
|
|
@ -28,9 +28,9 @@ public abstract class InvertedScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
|
|
@ -15,9 +15,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class NeonCactusFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
BlockState ground = world.getBlockState(pos.below());
|
||||
if (!ground.is(EndBlocks.ENDSTONE_DUST) && !ground.is(EndBlocks.END_MOSS)) {
|
||||
return false;
|
||||
|
|
|
@ -58,9 +58,9 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
center = getCenterGround(world, center);
|
||||
|
||||
if (!canSpawn(world, center)) {
|
||||
|
|
|
@ -36,9 +36,9 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
POS.set(center);
|
||||
|
|
|
@ -28,9 +28,9 @@ public abstract class WallScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
if (maxY < 10 || maxY < minY) {
|
||||
|
|
|
@ -37,9 +37,9 @@ public class BushFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
|
|
@ -41,9 +41,9 @@ public class BushWithOuterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
|
|
@ -21,9 +21,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class LargeAmaranitaFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class Lumecorn extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ public class TenaneaBushFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = pos.getY() + BlocksHelper.upRay(world, pos, 16);
|
||||
int minY = pos.getY() - BlocksHelper.downRay(world, pos, 16);
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ public class DesertLakeFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos blockPos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
double radius = MHelper.randRange(8.0, 15.0, random);
|
||||
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
||||
int dist = MHelper.floor(radius);
|
||||
|
|
|
@ -27,9 +27,9 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos blockPos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
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);
|
||||
|
|
|
@ -26,9 +26,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class FallenPillarFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
||||
|
|
|
@ -24,10 +24,10 @@ import ru.betterend.registry.EndFeatures;
|
|||
public class FloatingSpireFeature extends SpireFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
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);
|
||||
|
|
|
@ -36,9 +36,9 @@ public class IceStarFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
float size = MHelper.randRange(minSize, maxSize, random);
|
||||
int count = MHelper.randRange(minCount, maxCount, random);
|
||||
List<Vector3f> points = getFibonacciPoints(count);
|
||||
|
|
|
@ -23,9 +23,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class ObsidianBoulderFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
|
|
|
@ -26,9 +26,9 @@ import java.util.Random;
|
|||
public class ObsidianPillarBasementFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
||||
return false;
|
||||
|
|
|
@ -37,9 +37,9 @@ public class OreLayerFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
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();
|
||||
|
|
|
@ -23,9 +23,9 @@ public class SingleBlockFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ public class SpireFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)
|
||||
|| !world.getBlockState(pos.below(6)).is(TagAPI.GEN_TERRAIN)) {
|
||||
|
|
|
@ -30,9 +30,9 @@ public class StalactiteFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!isGround(world.getBlockState(ceiling ? pos.above() : pos.below()).getBlock())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class SulphurHillFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
if (pos.getY() < 57 || pos.getY() > 70) {
|
||||
return false;
|
||||
|
|
|
@ -34,9 +34,9 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int radius = MHelper.randRange(10, 30, random);
|
||||
|
||||
int top = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -23,13 +19,18 @@ import ru.betterend.blocks.SulphurCrystalBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class SulphuricLakeFeature extends DefaultFeature {
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
blockPos = getPosOnSurfaceWG(world, blockPos);
|
||||
|
||||
if (blockPos.getY() < 57) {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -15,10 +13,14 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.blocks.HydrothermalVentBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SurfaceVentFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -29,7 +30,10 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
Set<BlockPos> floorPositions = Sets.newHashSet();
|
||||
Set<BlockPos> ceilPositions = Sets.newHashSet();
|
||||
int sx = (pos.getX() >> 4) << 4;
|
||||
|
@ -111,7 +115,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.above(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -127,7 +131,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package ru.betterend.world.features.terrain.caves;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -15,9 +10,9 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -30,6 +25,10 @@ import ru.betterend.registry.EndBiomes;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class EndCaveFeature extends DefaultFeature {
|
||||
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||
protected static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||
|
@ -37,7 +36,10 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
private static final Vec3i[] SPHERE;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (pos.getX() * pos.getX() + pos.getZ() * pos.getZ() <= 2500) {
|
||||
return false;
|
||||
}
|
||||
|
@ -94,7 +96,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.above(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -110,7 +112,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
package ru.betterend.world.features.terrain.caves;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -17,9 +11,9 @@ import net.minecraft.world.level.biome.Biome;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -29,6 +23,11 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class TunelCaveFeature extends EndCaveFeature {
|
||||
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
|
||||
int cx = center.getX() >> 4;
|
||||
|
@ -107,7 +106,10 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (pos.getX() * pos.getX() + pos.getZ() * pos.getZ() <= 2500) {
|
||||
return false;
|
||||
}
|
||||
|
@ -189,7 +191,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.above(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -206,7 +208,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -42,9 +43,11 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(10, 25, random);
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -33,9 +34,11 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(5, 10, random);
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -34,9 +35,11 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
BlocksHelper.setWithoutUpdate(world, pos, AIR);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -33,9 +34,11 @@ public class JellyshroomFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState bark = EndBlocks.JELLYSHROOM.bark.defaultBlockState();
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -35,8 +36,10 @@ public class LacugroveFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1,30 +1,21 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -34,6 +25,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class LucerniaFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
@ -42,9 +37,12 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final NoneFeatureConfiguration config = featureConfig.config();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(12, 20, random);
|
||||
|
|
|
@ -1,29 +1,16 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFBinary;
|
||||
import ru.bclib.sdf.operator.SDFCoordModify;
|
||||
import ru.bclib.sdf.operator.SDFFlatWave;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.sdf.primitive.SDFPrimitive;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
|
@ -36,6 +23,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class MossyGlowshroomFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Vector3f CENTER = new Vector3f();
|
||||
|
@ -49,8 +40,10 @@ public class MossyGlowshroomFeature extends DefaultFeature {
|
|||
private static final SDFPrimitive ROOTS;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
BlockState down = world.getBlockState(blockPos.below());
|
||||
if (!down.is(EndBlocks.END_MYCELIUM) && !down.is(EndBlocks.END_MOSS))
|
||||
return false;
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -30,13 +25,20 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PythadendronTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Function<BlockState, Boolean> IGNORE;
|
||||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (world.getBlockState(pos.below()).getBlock() != EndBlocks.CHORUS_NYLIUM) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,30 +1,21 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -34,6 +25,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TenaneaFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
@ -41,9 +36,11 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> SPLINE;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(7, 10, random);
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
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.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFFlatWave;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -34,15 +23,22 @@ import ru.betterend.blocks.UmbrellaTreeClusterBlock;
|
|||
import ru.betterend.blocks.UmbrellaTreeMembraneBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UmbrellaTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final List<Vector3f> SPLINE;
|
||||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final NoneFeatureConfiguration config = featureConfig.config();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState wood = EndBlocks.UMBRELLA_TREE.bark.defaultBlockState();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CavePiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public CavePiece(StructureManager manager, CompoundTag tag) {
|
||||
public CavePiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.CAVE_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
|
@ -32,8 +33,8 @@ public class CrystalMountainPiece extends MountainPiece {
|
|||
top = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
public CrystalMountainPiece(StructureManager manager, CompoundTag tag) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, manager, tag);
|
||||
public CrystalMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, serverLevel, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,7 +59,7 @@ public class LakePiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public LakePiece(StructureManager manager, CompoundTag tag) {
|
||||
public LakePiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.LAKE_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public MountainPiece(StructurePieceType type, StructureManager manager, CompoundTag tag) {
|
||||
public MountainPiece(StructurePieceType type, ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(type, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
@ -130,9 +130,11 @@ public abstract class MountainPiece extends BasePiece {
|
|||
|
||||
private void makeBoundingBox() {
|
||||
int minX = MHelper.floor(center.getX() - radius);
|
||||
int minY = MHelper.floor(center.getY() - radius);
|
||||
int minZ = MHelper.floor(center.getZ() - radius);
|
||||
int maxX = MHelper.floor(center.getX() + radius + 1);
|
||||
int maxY = MHelper.floor(center.getY() + radius + 1);
|
||||
int maxZ = MHelper.floor(center.getZ() + radius + 1);
|
||||
this.boundingBox = new BoundingBox(minX, minZ, maxX, maxZ);
|
||||
this.boundingBox = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class NBTPiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public NBTPiece(StructureManager manager, CompoundTag tag) {
|
||||
public NBTPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.NBT_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public class PaintedMountainPiece extends MountainPiece {
|
|||
this.slises = slises;
|
||||
}
|
||||
|
||||
public PaintedMountainPiece(StructureManager manager, CompoundTag tag) {
|
||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, manager, tag);
|
||||
public PaintedMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, serverLevel, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,13 +25,13 @@ public class VoxelPiece extends BasePiece {
|
|||
this.boundingBox = world.getBounds();
|
||||
}
|
||||
|
||||
public VoxelPiece(StructureManager manager, CompoundTag tag) {
|
||||
public VoxelPiece(ServerLevel level, CompoundTag tag) {
|
||||
super(EndStructures.VOXEL_PIECE, tag);
|
||||
this.boundingBox = world.getBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag compoundTag) {
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
tag.put("world", world.toBNT());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue