Fixed place
-Methods (Pt. II)
This commit is contained in:
parent
a82f30b95d
commit
05f59b4856
18 changed files with 99 additions and 44 deletions
|
@ -54,7 +54,7 @@ public class NightshadeRedwoods extends EndBiome {
|
||||||
});
|
});
|
||||||
|
|
||||||
for (MobCategory group: MobCategory.values()) {
|
for (MobCategory group: MobCategory.values()) {
|
||||||
List<SpawnerData> list = biome.getMobSettings().getMobs(group);
|
List<SpawnerData> list = biome.getMobSettings().getMobs(group).unwrap();
|
||||||
list.forEach((entry) -> {
|
list.forEach((entry) -> {
|
||||||
def.addMobSpawn(entry);
|
def.addMobSpawn(entry);
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -21,8 +22,11 @@ import ru.betterend.integration.Integrations;
|
||||||
|
|
||||||
public class BigEtherTreeFeature extends DefaultFeature {
|
public class BigEtherTreeFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
|
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BlockState log = Integrations.BYG.getDefaultState("ether_log");
|
BlockState log = Integrations.BYG.getDefaultState("ether_log");
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.mojang.math.Vector3f;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -20,8 +21,10 @@ import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
int maxY = pos.getY() + BlocksHelper.upRay(world, pos, 16);
|
int maxY = pos.getY() + BlocksHelper.upRay(world, pos, 16);
|
||||||
int minY = pos.getY() - BlocksHelper.downRay(world, pos, 16);
|
int minY = pos.getY() - BlocksHelper.downRay(world, pos, 16);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
|
@ -25,7 +26,10 @@ public class DesertLakeFeature extends DefaultFeature {
|
||||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration featureConfig) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
|
Random random = featureConfig.random();
|
||||||
|
BlockPos blockPos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
double radius = MHelper.randRange(8.0, 15.0, random);
|
double radius = MHelper.randRange(8.0, 15.0, random);
|
||||||
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
||||||
int dist = MHelper.floor(radius);
|
int dist = MHelper.floor(radius);
|
||||||
|
@ -163,7 +167,7 @@ public class DesertLakeFeature extends DefaultFeature {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, state);
|
BlocksHelper.setWithoutUpdate(world, POS, state);
|
||||||
}
|
}
|
||||||
pos = POS.below();
|
pos = POS.below();
|
||||||
if (world.getBlockState(pos).getBlock().is(TagAPI.GEN_TERRAIN)) {
|
if (world.getBlockState(pos).is(TagAPI.GEN_TERRAIN)) {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
|
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
|
||||||
}
|
}
|
||||||
pos = POS.above();
|
pos = POS.above();
|
||||||
|
@ -205,7 +209,6 @@ public class DesertLakeFeature extends DefaultFeature {
|
||||||
|| state.is(TagAPI.GEN_TERRAIN)
|
|| state.is(TagAPI.GEN_TERRAIN)
|
||||||
|| state.is(EndBlocks.ENDSTONE_DUST)
|
|| state.is(EndBlocks.ENDSTONE_DUST)
|
||||||
|| state.getMaterial().equals(Material.PLANT)
|
|| state.getMaterial().equals(Material.PLANT)
|
||||||
|| state.getMaterial().equals(Material.WATER_PLANT)
|
|| state.getMaterial().equals(Material.WATER_PLANT);
|
||||||
|| state.getMaterial().equals(Material.CORAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
|
@ -25,7 +26,10 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration featureConfig) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
|
Random random = featureConfig.random();
|
||||||
|
BlockPos blockPos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
double radius = MHelper.randRange(10.0, 20.0, random);
|
double radius = MHelper.randRange(10.0, 20.0, random);
|
||||||
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
||||||
int dist = MHelper.floor(radius);
|
int dist = MHelper.floor(radius);
|
||||||
|
@ -163,7 +167,7 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
BlocksHelper.setWithoutUpdate(world, POS, state);
|
BlocksHelper.setWithoutUpdate(world, POS, state);
|
||||||
}
|
}
|
||||||
pos = POS.below();
|
pos = POS.below();
|
||||||
if (world.getBlockState(pos).getBlock().is(TagAPI.GEN_TERRAIN)) {
|
if (world.getBlockState(pos).is(TagAPI.GEN_TERRAIN)) {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
|
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
|
||||||
}
|
}
|
||||||
pos = POS.above();
|
pos = POS.above();
|
||||||
|
@ -199,7 +203,6 @@ public class EndLakeFeature extends DefaultFeature {
|
||||||
|| state.is(TagAPI.GEN_TERRAIN)
|
|| state.is(TagAPI.GEN_TERRAIN)
|
||||||
|| state.is(EndBlocks.ENDSTONE_DUST)
|
|| state.is(EndBlocks.ENDSTONE_DUST)
|
||||||
|| state.getMaterial().equals(Material.PLANT)
|
|| state.getMaterial().equals(Material.PLANT)
|
||||||
|| state.getMaterial().equals(Material.WATER_PLANT)
|
|| state.getMaterial().equals(Material.WATER_PLANT);
|
||||||
|| state.getMaterial().equals(Material.CORAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -24,7 +25,10 @@ import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
public class FallenPillarFeature extends DefaultFeature {
|
public class FallenPillarFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
pos = getPosOnSurface(world,
|
pos = getPosOnSurface(world,
|
||||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||||
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.api.BiomeAPI;
|
import ru.bclib.api.BiomeAPI;
|
||||||
import ru.bclib.sdf.SDF;
|
import ru.bclib.sdf.SDF;
|
||||||
|
@ -22,8 +23,11 @@ import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
public class FloatingSpireFeature extends SpireFeature {
|
public class FloatingSpireFeature extends SpireFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
|
ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||||
int minY = getYOnSurface(world, pos.getX(), pos.getZ());
|
int minY = getYOnSurface(world, pos.getX(), pos.getZ());
|
||||||
int y = minY > 57 ? MHelper.floor(MHelper.randRange(minY, minY * 2, random) * 0.5F + 32)
|
int y = minY > 57 ? MHelper.floor(MHelper.randRange(minY, minY * 2, random) * 0.5F + 32)
|
||||||
: MHelper.randRange(64, 192, random);
|
: MHelper.randRange(64, 192, random);
|
||||||
|
@ -64,7 +68,7 @@ public class FloatingSpireFeature extends SpireFeature {
|
||||||
|
|
||||||
support.forEach((bpos) -> {
|
support.forEach((bpos) -> {
|
||||||
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||||
EndFeatures.TENANEA_BUSH.getFeature().place(world, chunkGenerator, random, bpos, null);
|
EndFeatures.TENANEA_BUSH.getFeature().place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -47,9 +48,11 @@ public class GeyserFeature extends DefaultFeature {
|
||||||
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
|
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
final Random random = featureConfig.random();
|
||||||
pos = getPosOnSurfaceWG(world, pos);
|
final WorldGenLevel world = featureConfig.level();
|
||||||
|
final BlockPos pos = getPosOnSurfaceWG(world, featureConfig.origin());
|
||||||
|
final ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||||
|
|
||||||
if (pos.getY() < 10) {
|
if (pos.getY() < 10) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -241,7 +244,7 @@ public class GeyserFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EndFeatures.SULPHURIC_LAKE.getFeature().place(world, chunkGenerator, random, pos, null);
|
EndFeatures.SULPHURIC_LAKE.getFeature().place(new FeaturePlaceContext<>(world, chunkGenerator, random, pos, null));
|
||||||
|
|
||||||
double distance = radius1 * 1.7;
|
double distance = radius1 * 1.7;
|
||||||
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);
|
BlockPos start = pos.offset(-distance, -halfHeight - 15 - distance, -distance);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.sdf.SDF;
|
import ru.bclib.sdf.SDF;
|
||||||
import ru.bclib.sdf.operator.SDFRotation;
|
import ru.bclib.sdf.operator.SDFRotation;
|
||||||
|
@ -34,8 +35,10 @@ public class IceStarFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
float size = MHelper.randRange(minSize, maxSize, random);
|
float size = MHelper.randRange(minSize, maxSize, random);
|
||||||
int count = MHelper.randRange(minCount, maxCount, random);
|
int count = MHelper.randRange(minCount, maxCount, random);
|
||||||
List<Vector3f> points = getFibonacciPoints(count);
|
List<Vector3f> points = getFibonacciPoints(count);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -21,8 +22,10 @@ import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
public class ObsidianBoulderFeature extends DefaultFeature {
|
public class ObsidianBoulderFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
pos = getPosOnSurface(world,
|
pos = getPosOnSurface(world,
|
||||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package ru.betterend.world.features.terrain;
|
package ru.betterend.world.features.terrain;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -24,9 +21,14 @@ import ru.bclib.world.features.DefaultFeature;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class ObsidianPillarBasementFeature extends DefaultFeature {
|
public class ObsidianPillarBasementFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
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)) {
|
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.sdf.SDF;
|
import ru.bclib.sdf.SDF;
|
||||||
import ru.bclib.sdf.operator.SDFCoordModify;
|
import ru.bclib.sdf.operator.SDFCoordModify;
|
||||||
|
@ -35,8 +36,10 @@ public class OreLayerFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
float radius = this.radius * 0.5F;
|
float radius = this.radius * 0.5F;
|
||||||
int r = MHelper.floor(radius + 1);
|
int r = MHelper.floor(radius + 1);
|
||||||
int posX = MHelper.randRange(Math.max(r - 16, 0), Math.min(31 - r, 15), random) + pos.getX();
|
int posX = MHelper.randRange(Math.max(r - 16, 0), Math.min(31 - r, 15), random) + pos.getX();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
|
@ -21,7 +22,10 @@ public class SingleBlockFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
|
@ -17,8 +18,10 @@ import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.LeavesBlock;
|
import net.minecraft.world.level.block.LeavesBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.BiomeAPI;
|
import ru.bclib.api.BiomeAPI;
|
||||||
|
@ -32,8 +33,11 @@ public class SpireFeature extends DefaultFeature {
|
||||||
protected static final Function<BlockState, Boolean> REPLACE;
|
protected static final Function<BlockState, Boolean> REPLACE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
|
ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||||
pos = getPosOnSurfaceWG(world, pos);
|
pos = getPosOnSurfaceWG(world, pos);
|
||||||
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)
|
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)
|
||||||
|| !world.getBlockState(pos.below(6)).is(TagAPI.GEN_TERRAIN)) {
|
|| !world.getBlockState(pos.below(6)).is(TagAPI.GEN_TERRAIN)) {
|
||||||
|
@ -68,7 +72,7 @@ public class SpireFeature extends DefaultFeature {
|
||||||
|
|
||||||
support.forEach((bpos) -> {
|
support.forEach((bpos) -> {
|
||||||
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
|
||||||
EndFeatures.TENANEA_BUSH.getFeature().place(world, chunkGenerator, random, bpos, null);
|
EndFeatures.TENANEA_BUSH.getFeature().place(new FeaturePlaceContext<>(world, chunkGenerator, random, bpos, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.blocks.StalactiteBlock;
|
import ru.bclib.blocks.StalactiteBlock;
|
||||||
|
@ -28,8 +29,10 @@ public class StalactiteFeature extends DefaultFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
if (!isGround(world.getBlockState(ceiling ? pos.above() : pos.below()).getBlock())) {
|
if (!isGround(world.getBlockState(ceiling ? pos.above() : pos.below()).getBlock())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
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.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import ru.bclib.blocks.BlockProperties;
|
import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
|
@ -19,8 +20,10 @@ import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
public class SulphurHillFeature extends DefaultFeature {
|
public class SulphurHillFeature extends DefaultFeature {
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
pos = getPosOnSurfaceWG(world, pos);
|
pos = getPosOnSurfaceWG(world, pos);
|
||||||
if (pos.getY() < 57 || pos.getY() > 70) {
|
if (pos.getY() < 57 || pos.getY() > 70) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.api.TagAPI;
|
import ru.bclib.api.TagAPI;
|
||||||
|
@ -32,8 +33,10 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
||||||
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
|
private static final Direction[] HORIZONTAL = BlocksHelper.makeHorizontal();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
NoneFeatureConfiguration config) {
|
Random random = featureConfig.random();
|
||||||
|
BlockPos pos = featureConfig.origin();
|
||||||
|
WorldGenLevel world = featureConfig.level();
|
||||||
int radius = MHelper.randRange(10, 30, random);
|
int radius = MHelper.randRange(10, 30, random);
|
||||||
|
|
||||||
int top = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
int top = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue