Continue migration
This commit is contained in:
parent
47ed597358
commit
33dbfbe633
263 changed files with 1450 additions and 1486 deletions
|
@ -12,13 +12,13 @@ import net.minecraft.core.particles.ParticleOptions;
|
|||
import net.minecraft.sound.BiomeAdditionsSound;
|
||||
import net.minecraft.sound.BiomeMoodSound;
|
||||
import net.minecraft.sound.MusicSound;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biome.Category;
|
||||
import net.minecraft.world.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome.Category;
|
||||
import net.minecraft.world.level.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.biome.BiomeEffects.Builder;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
import net.minecraft.world.biome.GenerationSettings;
|
||||
|
@ -28,8 +28,8 @@ import net.minecraft.world.gen.GenerationStep.Carver;
|
|||
import net.minecraft.world.gen.GenerationStep.Feature;
|
||||
import net.minecraft.world.gen.ProbabilityConfig;
|
||||
import net.minecraft.world.gen.carver.ConfiguredCarver;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilder;
|
||||
import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilders;
|
||||
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
|
||||
|
@ -119,7 +119,7 @@ public class BiomeDefinition {
|
|||
|
||||
public BiomeDefinition addMobSpawn(EntityType<?> type, int weight, int minGroupSize, int maxGroupSize) {
|
||||
ResourceLocation eID = Registry.ENTITY_TYPE.getId(type);
|
||||
if (eID != Registry.ENTITY_TYPE.getDefaultId()) {
|
||||
if (eID != Registry.ENTITY_TYPE.getDefaultKey()) {
|
||||
SpawnInfo info = new SpawnInfo();
|
||||
info.type = type;
|
||||
info.weight = weight;
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.google.gson.JsonObject;
|
|||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.util.JsonFactory;
|
||||
import ru.betterend.util.StructureHelper;
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.util.collection.WeightedList;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndEntities;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
|
|
@ -3,8 +3,8 @@ package ru.betterend.world.biome.land;
|
|||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.gen.GenerationStep.Feature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndEntities;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ru.betterend.world.biome.land;
|
|||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndEntities;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ru.betterend.world.biome.land;
|
|||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ru.betterend.world.biome.land;
|
|||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndEntities;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeatures;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
|
|
@ -6,10 +6,10 @@ 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.biome.Biome;
|
||||
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.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.gen.surfacebuilder.SurfaceConfig;
|
||||
import net.minecraft.world.gen.surfacebuilder.TernarySurfaceConfig;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
@ -28,10 +28,10 @@ public class BiomeIslandFeature extends DefaultFeature {
|
|||
private static BlockState underBlock = Blocks.DIRT.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) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
SurfaceConfig surfaceConfig = biome.getGenerationSettings().getSurfaceConfig();
|
||||
SurfaceConfig surfaceConfig = biome.getGenerationSettings().getSurfaceBuilderConfig();
|
||||
BlockState topMaterial = surfaceConfig.getTopMaterial();
|
||||
if (BlocksHelper.isFluid(topMaterial)) {
|
||||
topBlock = ((TernarySurfaceConfig) surfaceConfig).getUnderwaterMaterial();
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -17,8 +17,7 @@ public class BlueVineFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F
|
||||
+ random.nextFloat() * 0.4F;
|
||||
small = d > 0.5F;
|
||||
|
@ -26,7 +25,7 @@ public class BlueVineFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
if (small) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos,
|
||||
EndBlocks.BLUE_VINE_SEED.defaultBlockState().with(EndPlantWithAgeBlock.AGE, random.nextInt(4)));
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class CavePlantFeature extends FullHeightScatterFeature {
|
||||
|
@ -16,13 +16,12 @@ public class CavePlantFeature extends FullHeightScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return plant.canPlaceAt(world.getBlockState(blockPos), world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, plant);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
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.blocks.BlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -13,8 +13,8 @@ import ru.betterend.util.BlocksHelper;
|
|||
|
||||
public class CavePumpkinFeature 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.up()).isIn(EndTags.GEN_TERRAIN) || !world.isAir(pos)
|
||||
|| !world.isAir(pos.below())) {
|
||||
return false;
|
||||
|
|
|
@ -16,10 +16,10 @@ import net.minecraft.world.level.block.Rotation;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.WorldView;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
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.util.MHelper;
|
||||
|
@ -31,7 +31,7 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
private Structure structure;
|
||||
|
||||
@Override
|
||||
protected Structure getStructure(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected Structure getStructure(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
if (structure == null) {
|
||||
structure = world.toServerWorld().getStructureManager()
|
||||
.getStructureOrBlank(new ResourceLocation("end_city/ship"));
|
||||
|
@ -43,7 +43,7 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
long x = pos.getX() >> 4;
|
||||
long z = pos.getX() >> 4;
|
||||
if (x * x + z * z < 3600) {
|
||||
|
@ -53,30 +53,30 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Rotation getRotation(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected Rotation getRotation(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return Rotation.random(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockMirror getMirror(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected BlockMirror getMirror(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return BlockMirror.values()[random.nextInt(3)];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYOffset(Structure structure, StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected int getYOffset(Structure structure, WorldGenLevel world, BlockPos pos, Random random) {
|
||||
int min = structure.getSize().getY() >> 3;
|
||||
int max = structure.getSize().getY() >> 2;
|
||||
return -MHelper.randRange(min, max, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TerrainMerge getTerrainMerge(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected TerrainMerge getTerrainMerge(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return TerrainMerge.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
center = new BlockPos(((center.getX() >> 4) << 4) | 8, 128, ((center.getZ() >> 4) << 4) | 8);
|
||||
center = getGround(world, center);
|
||||
BlockBox bounds = makeBox(center);
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public abstract class DefaultFeature extends Feature<DefaultFeatureConfig> {
|
||||
public abstract class DefaultFeature extends Feature<NoneFeatureConfiguration> {
|
||||
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
protected static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
||||
public DefaultFeature() {
|
||||
super(DefaultFeatureConfig.CODEC);
|
||||
super(NoneFeatureConfiguration.CODEC);
|
||||
}
|
||||
|
||||
public static int getYOnSurface(StructureWorldAccess world, int x, int z) {
|
||||
return world.getTopY(Type.WORLD_SURFACE, x, z);
|
||||
public static int getYOnSurface(WorldGenLevel world, int x, int z) {
|
||||
return world.getHeight(Types.WORLD_SURFACE, x, z);
|
||||
}
|
||||
|
||||
public static int getYOnSurfaceWG(StructureWorldAccess world, int x, int z) {
|
||||
return world.getTopY(Type.WORLD_SURFACE_WG, x, z);
|
||||
public static int getYOnSurfaceWG(WorldGenLevel world, int x, int z) {
|
||||
return world.getHeight(Types.WORLD_SURFACE_WG, x, z);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurface(StructureWorldAccess world, BlockPos pos) {
|
||||
return world.getTopPosition(Type.WORLD_SURFACE, pos);
|
||||
public static BlockPos getPosOnSurface(WorldGenLevel world, BlockPos pos) {
|
||||
return world.getHeightmapPos(Types.WORLD_SURFACE, pos);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurfaceWG(StructureWorldAccess world, BlockPos pos) {
|
||||
return world.getTopPosition(Type.WORLD_SURFACE_WG, pos);
|
||||
public static BlockPos getPosOnSurfaceWG(WorldGenLevel world, BlockPos pos) {
|
||||
return world.getHeightmapPos(Types.WORLD_SURFACE_WG, pos);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurfaceRaycast(StructureWorldAccess world, BlockPos pos) {
|
||||
public static BlockPos getPosOnSurfaceRaycast(WorldGenLevel world, BlockPos pos) {
|
||||
return getPosOnSurfaceRaycast(world, pos, 256);
|
||||
}
|
||||
|
||||
public static BlockPos getPosOnSurfaceRaycast(StructureWorldAccess world, BlockPos pos, int dist) {
|
||||
public static BlockPos getPosOnSurfaceRaycast(WorldGenLevel world, BlockPos pos, int dist) {
|
||||
int h = BlocksHelper.downRay(world, pos, dist);
|
||||
return pos.down(h);
|
||||
return pos.below(h);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.DoublePlantBlock;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
@ -22,8 +22,7 @@ public class DoublePlantFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F
|
||||
+ random.nextFloat() * 0.4F;
|
||||
plant = d < 0.5F ? largePlant : smallPlant;
|
||||
|
@ -31,7 +30,7 @@ public class DoublePlantFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
if (plant instanceof DoublePlantBlock) {
|
||||
int rot = random.nextInt(4);
|
||||
BlockState state = plant.defaultBlockState().with(DoublePlantBlock.ROTATION, rot);
|
||||
|
|
|
@ -5,19 +5,19 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.structure.rule.BlockMatchRuleTest;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.gen.CountConfig;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeatureConfig;
|
||||
import net.minecraft.world.level.levelgen.feature.OreFeatureConfig;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.blocks.complex.StoneMaterial;
|
||||
import ru.betterend.world.features.terrain.OreLayerFeature;
|
||||
|
@ -37,7 +37,7 @@ public class EndFeature {
|
|||
this.featureConfigured = configuredFeature;
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, GenerationStep.Feature featureStep,
|
||||
public EndFeature(String name, Feature<NoneFeatureConfiguration> feature, GenerationStep.Feature featureStep,
|
||||
ConfiguredFeature<?, ?> configuredFeature) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
this.featureStep = featureStep;
|
||||
|
@ -45,7 +45,7 @@ public class EndFeature {
|
|||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, configuredFeature);
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
public EndFeature(String name, Feature<NoneFeatureConfiguration> feature) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
|
@ -53,7 +53,7 @@ public class EndFeature {
|
|||
.configure(FeatureConfig.DEFAULT).decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(100))));
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, int density) {
|
||||
public EndFeature(String name, Feature<NoneFeatureConfiguration> feature, int density) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
|
@ -62,13 +62,13 @@ public class EndFeature {
|
|||
.repeatRandomly(density));
|
||||
}
|
||||
|
||||
public static EndFeature makeRawGenFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
public static EndFeature makeRawGenFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT)
|
||||
.decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeLakeFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
public static EndFeature makeLakeFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT)
|
||||
.decorate(Decorator.WATER_LAKE.configure(new ChanceDecoratorConfig(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.LAKES, configured);
|
||||
|
@ -113,25 +113,25 @@ public class EndFeature {
|
|||
return new EndFeature(name, layer, GenerationStep.Feature.UNDERGROUND_ORES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeChunkFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
public static EndFeature makeChunkFeature(String name, Feature<NoneFeatureConfiguration> feature) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT)
|
||||
.decorate(Decorator.COUNT.configure(new CountConfig(1)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.LOCAL_MODIFICATIONS, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeChansedFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
public static EndFeature makeChansedFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT)
|
||||
.decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.SURFACE_STRUCTURES, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeCountRawFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
public static EndFeature makeCountRawFeature(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT)
|
||||
.decorate(Decorator.COUNT.configure(new CountConfig(chance)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeFeatureConfigured(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
public static EndFeature makeFeatureConfigured(String name, Feature<NoneFeatureConfiguration> feature) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT);
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.EndLilySeedBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class EndLilyFeature extends UnderwaterPlantScatter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
EndLilySeedBlock seed = (EndLilySeedBlock) EndBlocks.END_LILY_SEED;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.EndLotusSeedBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class EndLotusFeature extends UnderwaterPlantScatter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
EndLotusSeedBlock seed = (EndLotusSeedBlock) EndBlocks.END_LOTUS_SEED;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ 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.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.EndLotusLeafBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -19,7 +19,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
if (canGenerate(world, blockPos)) {
|
||||
generateLeaf(world, blockPos);
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ public class EndLotusLeafFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return getPosOnSurface(world, pos);
|
||||
}
|
||||
|
||||
private void generateLeaf(StructureWorldAccess world, BlockPos pos) {
|
||||
private void generateLeaf(WorldGenLevel world, BlockPos pos) {
|
||||
MutableBlockPos p = new MutableBlockPos();
|
||||
BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, leaf.with(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM));
|
||||
|
@ -51,7 +51,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean canGenerate(StructureWorldAccess world, BlockPos pos) {
|
||||
private boolean canGenerate(WorldGenLevel world, BlockPos pos) {
|
||||
MutableBlockPos p = new MutableBlockPos();
|
||||
p.setY(pos.getY());
|
||||
int count = 0;
|
||||
|
@ -67,8 +67,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return world.isAir(blockPos) && world.getBlockState(blockPos.below()).is(Blocks.WATER);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -19,7 +19,7 @@ public class FilaluxFeature extends SkyScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
BlockState vine = EndBlocks.FILALUX.defaultBlockState();
|
||||
BlockState wings = EndBlocks.FILALUX_WINGS.defaultBlockState();
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.FILALUX_LANTERN);
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.Random;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
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.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
|
@ -19,14 +19,14 @@ public abstract class FullHeightScatterFeature extends DefaultFeature {
|
|||
this.radius = radius;
|
||||
}
|
||||
|
||||
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
|
||||
public abstract void generate(StructureWorldAccess world, Random random, BlockPos blockPos);
|
||||
public abstract void place(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
int maxY = world.getTopY(Heightmap.Type.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--) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
@ -13,13 +13,12 @@ public class GlowPillarFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return EndBlocks.GLOWING_PILLAR_SEED.canPlaceAt(AIR, world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
EndPlantWithAgeBlock seed = ((EndPlantWithAgeBlock) EndBlocks.GLOWING_PILLAR_SEED);
|
||||
seed.growAdult(world, random, blockPos);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.HydraluxSaplingBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class HydraluxFeature extends UnderwaterPlantScatter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
HydraluxSaplingBlock seed = (HydraluxSaplingBlock) EndBlocks.HYDRALUX_SAPLING;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.Random;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
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.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
|
@ -19,14 +19,14 @@ public abstract class InvertedScatterFeature extends DefaultFeature {
|
|||
this.radius = radius;
|
||||
}
|
||||
|
||||
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
|
||||
public abstract void generate(StructureWorldAccess world, Random random, BlockPos blockPos);
|
||||
public abstract void place(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
int maxY = world.getTopY(Heightmap.Type.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--) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.features;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
|
@ -13,13 +13,12 @@ public class LanceleafFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return EndBlocks.LANCELEAF_SEED.canPlaceAt(AIR, world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
EndPlantWithAgeBlock seed = ((EndPlantWithAgeBlock) EndBlocks.LANCELEAF_SEED);
|
||||
seed.growAdult(world, random, blockPos);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.structure.StructurePlacementData;
|
|||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.StructureHelper;
|
||||
|
||||
|
@ -21,35 +21,35 @@ public class ListFeature extends NBTStructureFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Structure getStructure(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected Structure getStructure(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
selected = list.get(random.nextInt(list.size()));
|
||||
return selected.getStructure();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
int cx = pos.getX() >> 4;
|
||||
int cz = pos.getZ() >> 4;
|
||||
return ((cx + cz) & 1) == 0 && pos.getY() > 58 && world.getBlockState(pos.below()).isIn(EndTags.GEN_TERRAIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rotation getRotation(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected Rotation getRotation(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return Rotation.random(random);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockMirror getMirror(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected BlockMirror getMirror(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return BlockMirror.values()[random.nextInt(3)];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYOffset(Structure structure, StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected int getYOffset(Structure structure, WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return selected.offsetY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TerrainMerge getTerrainMerge(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
protected TerrainMerge getTerrainMerge(WorldGenLevel world, BlockPos pos, Random random) {
|
||||
return selected.terrainMerge;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.function.Function;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class MengerSpongeFeature extends UnderwaterPlantScatter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.MENGER_SPONGE_WET);
|
||||
if (random.nextBoolean()) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
|
|
|
@ -17,10 +17,10 @@ import net.minecraft.util.math.BlockBox;
|
|||
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.biome.Biome;
|
||||
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.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.gen.surfacebuilder.SurfaceConfig;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -30,21 +30,21 @@ import ru.betterend.world.processors.DestructionStructureProcessor;
|
|||
public abstract class NBTStructureFeature extends DefaultFeature {
|
||||
protected static final DestructionStructureProcessor DESTRUCTION = new DestructionStructureProcessor();
|
||||
|
||||
protected abstract Structure getStructure(StructureWorldAccess world, BlockPos pos, Random random);
|
||||
protected abstract Structure getStructure(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract boolean canSpawn(StructureWorldAccess world, BlockPos pos, Random random);
|
||||
protected abstract boolean canSpawn(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract Rotation getRotation(StructureWorldAccess world, BlockPos pos, Random random);
|
||||
protected abstract Rotation getRotation(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract BlockMirror getMirror(StructureWorldAccess world, BlockPos pos, Random random);
|
||||
protected abstract BlockMirror getMirror(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract int getYOffset(Structure structure, StructureWorldAccess world, BlockPos pos, Random random);
|
||||
protected abstract int getYOffset(Structure structure, WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract TerrainMerge getTerrainMerge(StructureWorldAccess world, BlockPos pos, Random random);
|
||||
protected abstract TerrainMerge getTerrainMerge(WorldGenLevel world, BlockPos pos, Random random);
|
||||
|
||||
protected abstract void addStructureData(StructurePlacementData data);
|
||||
|
||||
protected BlockPos getGround(StructureWorldAccess world, BlockPos center) {
|
||||
protected BlockPos getGround(WorldGenLevel world, BlockPos center) {
|
||||
Biome biome = world.getBiome(center);
|
||||
ResourceLocation id = EndBiomes.getBiomeID(biome);
|
||||
if (id.getNamespace().contains("moutain") || id.getNamespace().contains("lake")) {
|
||||
|
@ -56,7 +56,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
protected int getAverageY(StructureWorldAccess world, BlockPos center) {
|
||||
protected int getAverageY(WorldGenLevel world, BlockPos center) {
|
||||
int y = getYOnSurface(world, center.getX(), center.getZ());
|
||||
y += getYOnSurface(world, center.getX() - 2, center.getZ() - 2);
|
||||
y += getYOnSurface(world, center.getX() + 2, center.getZ() - 2);
|
||||
|
@ -65,7 +65,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
return y / 5;
|
||||
}
|
||||
|
||||
protected int getAverageYWG(StructureWorldAccess world, BlockPos center) {
|
||||
protected int getAverageYWG(WorldGenLevel world, BlockPos center) {
|
||||
int y = getYOnSurfaceWG(world, center.getX(), center.getZ());
|
||||
y += getYOnSurfaceWG(world, center.getX() - 2, center.getZ() - 2);
|
||||
y += getYOnSurfaceWG(world, center.getX() + 2, center.getZ() - 2);
|
||||
|
@ -75,8 +75,8 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
center = new BlockPos(((center.getX() >> 4) << 4) | 8, 128, ((center.getZ() >> 4) << 4) | 8);
|
||||
center = getGround(world, center);
|
||||
|
||||
|
@ -132,7 +132,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
if (!stateSt.isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (merge == TerrainMerge.SURFACE) {
|
||||
SurfaceConfig config = world.getBiome(mut).getGenerationSettings()
|
||||
.getSurfaceConfig();
|
||||
.getSurfaceBuilderConfig();
|
||||
boolean isTop = mut.getY() == surfMax && state.getMaterial().blocksLight();
|
||||
BlockState top = isTop ? config.getTopMaterial() : config.getUnderMaterial();
|
||||
BlocksHelper.setWithoutUpdate(world, mut, top);
|
||||
|
@ -143,7 +143,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
if (stateSt.isIn(EndTags.END_GROUND) && state.getMaterial().blocksLight()) {
|
||||
if (merge == TerrainMerge.SURFACE) {
|
||||
SurfaceConfig config = world.getBiome(mut).getGenerationSettings()
|
||||
.getSurfaceConfig();
|
||||
.getSurfaceBuilderConfig();
|
||||
BlocksHelper.setWithoutUpdate(world, mut, config.getUnderMaterial());
|
||||
} else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.state.property.Properties;
|
|||
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.BlockProperties.TripleShape;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -17,8 +17,8 @@ import ru.betterend.util.MHelper;
|
|||
|
||||
public class NeonCactusFeature 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()).is(EndBlocks.ENDSTONE_DUST)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class NeonCactusFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void branch(StructureWorldAccess world, BlockPos pos, Direction dir, Random random, int length, int size) {
|
||||
private void branch(WorldGenLevel world, BlockPos pos, Direction dir, Random random, int length, int size) {
|
||||
int rotIndex = length >> 2;
|
||||
MutableBlockPos mut = new MutableBlockPos().set(pos);
|
||||
Direction hor = BlocksHelper.randomHorizontal(random);
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.Random;
|
|||
|
||||
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.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
@ -19,16 +19,16 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
this.radius = radius;
|
||||
}
|
||||
|
||||
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
|
||||
public abstract void generate(StructureWorldAccess world, Random random, BlockPos blockPos);
|
||||
public abstract void place(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return getPosOnSurfaceWG(world, pos);
|
||||
}
|
||||
|
||||
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos) {
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
if (pos.getY() < 5) {
|
||||
return false;
|
||||
} else if (!world.getBlockState(pos.below()).isIn(EndTags.END_GROUND)) {
|
||||
|
@ -37,7 +37,7 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected boolean getGroundPlant(StructureWorldAccess world, MutableBlockPos pos) {
|
||||
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
|
||||
int down = BlocksHelper.downRay(world, pos, 16);
|
||||
if (down > Math.abs(getYOffset() * 2)) {
|
||||
return false;
|
||||
|
@ -55,8 +55,8 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
center = getCenterGround(world, center);
|
||||
|
||||
if (!canSpawn(world, center)) {
|
||||
|
|
|
@ -9,9 +9,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.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -19,7 +19,7 @@ import ru.betterend.util.BlocksHelper;
|
|||
public class SilkMothNestFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
private boolean canGenerate(StructureWorldAccess world, BlockPos pos) {
|
||||
private boolean canGenerate(WorldGenLevel world, BlockPos pos) {
|
||||
BlockState state = world.getBlockState(pos.up());
|
||||
if (state.isIn(BlockTags.LEAVES) || state.isIn(BlockTags.LOGS)) {
|
||||
state = world.getBlockState(pos);
|
||||
|
@ -36,8 +36,8 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
int maxY = world.getTopY(Heightmap.Type.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
POS.set(center);
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.AttachedBlock;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
|
@ -20,8 +20,7 @@ public class SingleInvertedScatterFeature extends InvertedScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
if (!world.isAir(blockPos)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -33,7 +32,7 @@ public class SingleInvertedScatterFeature extends InvertedScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
BlockState state = block.defaultBlockState();
|
||||
if (block instanceof AttachedBlock) {
|
||||
state = state.with(Properties.FACING, Direction.DOWN);
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.DoublePlantBlock;
|
||||
import ru.betterend.blocks.basis.EndCropBlock;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
|
@ -40,18 +40,17 @@ public class SinglePlantFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return rawHeightmap ? getPosOnSurfaceWG(world, pos) : getPosOnSurface(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return plant.canPlaceAt(plant.defaultBlockState(), world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
if (plant instanceof DoublePlantBlock) {
|
||||
int rot = random.nextInt(4);
|
||||
BlockState state = plant.defaultBlockState().with(DoublePlantBlock.ROTATION, rot);
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
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.level.WorldGenLevel;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
|
@ -20,8 +20,7 @@ public abstract class SkyScatterFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
if (!world.isAir(blockPos)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -39,16 +38,16 @@ public abstract class SkyScatterFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos) {
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return new BlockPos(pos.getX(), MHelper.randRange(32, 192, world.getRandom()), pos.getZ());
|
||||
}
|
||||
|
||||
protected boolean getGroundPlant(StructureWorldAccess world, MutableBlockPos pos) {
|
||||
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
|
||||
pos.setY(pos.getY() + MHelper.randRange(-getYOffset(), getYOffset(), world.getRandom()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.DoublePlantBlock;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
|
@ -18,13 +18,12 @@ public class UnderwaterPlantFeature extends UnderwaterPlantScatter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return super.canSpawn(world, blockPos) && plant.canPlaceAt(plant.defaultBlockState(), world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
if (plant instanceof DoublePlantBlock) {
|
||||
int rot = random.nextInt(4);
|
||||
BlockState state = plant.defaultBlockState().with(DoublePlantBlock.ROTATION, rot);
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
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;
|
||||
|
||||
public abstract class UnderwaterPlantScatter extends ScatterFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
@ -15,26 +15,25 @@ public abstract class UnderwaterPlantScatter extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
POS.setX(pos.getX());
|
||||
POS.setZ(pos.getZ());
|
||||
POS.setY(0);
|
||||
return getGround(world, POS).toImmutable();
|
||||
return getGround(world, POS).immutable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return world.getBlockState(blockPos).is(Blocks.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos) {
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
return world.getBlockState(pos).is(Blocks.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getGroundPlant(StructureWorldAccess world, MutableBlockPos pos) {
|
||||
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
|
||||
return getGround(world, pos).getY() < 128;
|
||||
}
|
||||
|
||||
|
@ -48,7 +47,7 @@ public abstract class UnderwaterPlantScatter extends ScatterFeature {
|
|||
return 5;
|
||||
}
|
||||
|
||||
private BlockPos getGround(StructureWorldAccess world, MutableBlockPos pos) {
|
||||
private BlockPos getGround(WorldGenLevel world, MutableBlockPos pos) {
|
||||
while (pos.getY() < 128 && world.getFluidState(pos).isEmpty()) {
|
||||
pos.setY(pos.getY() + 1);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.VineBlock;
|
||||
|
@ -24,14 +24,13 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
BlockState state = world.getBlockState(blockPos);
|
||||
return state.getMaterial().isReplaceable() && canPlaceBlock(state, world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
int h = BlocksHelper.downRay(world, blockPos, random.nextInt(maxLength)) - 1;
|
||||
if (h > 2) {
|
||||
BlockState top = getTopState();
|
||||
|
@ -45,7 +44,7 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean canPlaceBlock(BlockState state, StructureWorldAccess world, BlockPos blockPos) {
|
||||
private boolean canPlaceBlock(BlockState state, WorldGenLevel world, BlockPos blockPos) {
|
||||
if (vine) {
|
||||
return ((VineBlock) vineBlock).canGenerate(state, world, blockPos);
|
||||
} else {
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.AttachedBlock;
|
||||
import ru.betterend.blocks.basis.EndWallPlantBlock;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -21,7 +21,7 @@ public class WallPlantFeature extends WallScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos pos, Direction dir) {
|
||||
if (block instanceof EndWallPlantBlock) {
|
||||
BlockState state = block.defaultBlockState().with(EndWallPlantBlock.FACING, dir);
|
||||
return block.canPlaceAt(state, world, pos);
|
||||
|
@ -33,7 +33,7 @@ public class WallPlantFeature extends WallScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
|
||||
public void place(WorldGenLevel world, Random random, BlockPos pos, Direction dir) {
|
||||
BlockState state = block.defaultBlockState();
|
||||
if (block instanceof EndWallPlantBlock) {
|
||||
state = state.with(EndWallPlantBlock.FACING, dir);
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
||||
public class WallPlantOnLogFeature extends WallPlantFeature {
|
||||
public WallPlantOnLogFeature(Block block, int radius) {
|
||||
|
@ -15,7 +15,7 @@ public class WallPlantOnLogFeature extends WallPlantFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos pos, Direction dir) {
|
||||
BlockPos blockPos = pos.relative(dir.getOpposite());
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
return blockState.isIn(BlockTags.LOGS);
|
||||
|
|
|
@ -6,9 +6,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.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
|
@ -20,13 +20,13 @@ public abstract class WallScatterFeature extends DefaultFeature {
|
|||
this.radius = radius;
|
||||
}
|
||||
|
||||
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir);
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos pos, Direction dir);
|
||||
|
||||
public abstract void generate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir);
|
||||
public abstract void place(WorldGenLevel world, Random random, BlockPos pos, Direction dir);
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
int maxY = world.getTopY(Heightmap.Type.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
if (maxY < 10 || maxY < minY) {
|
||||
|
|
|
@ -9,9 +9,9 @@ import net.minecraft.world.level.block.LeavesBlock;
|
|||
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.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -35,8 +35,8 @@ public class BushFeature 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()).getBlock().isIn(EndTags.END_GROUND)
|
||||
&& !world.getBlockState(pos.up()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
@ -46,7 +46,7 @@ public class BushFeature extends DefaultFeature {
|
|||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(this.leaves);
|
||||
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return MHelper.randRange(-2F, 2F, random);
|
||||
|
|
|
@ -10,9 +10,9 @@ import net.minecraft.world.level.material.Material;
|
|||
import net.minecraft.state.property.Properties;
|
||||
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.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -39,8 +39,8 @@ public class BushWithOuterFeature 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()).getBlock().isIn(EndTags.END_GROUND)
|
||||
&& !world.getBlockState(pos.up()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
@ -50,7 +50,7 @@ public class BushWithOuterFeature extends DefaultFeature {
|
|||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(this.leaves);
|
||||
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return MHelper.randRange(-2F, 2F, random);
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
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.BlockProperties.TripleShape;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -19,8 +19,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class LargeAmaranitaFeature 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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
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.LumecornShape;
|
||||
import ru.betterend.blocks.LumecornBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -19,8 +19,8 @@ import ru.betterend.world.features.DefaultFeature;
|
|||
|
||||
public class Lumecorn 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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ import net.minecraft.world.level.material.Material;
|
|||
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.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
|
@ -39,8 +39,8 @@ public class TenaneaBushFeature 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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class TenaneaBushFeature extends DefaultFeature {
|
|||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(leaves);
|
||||
sphere = new SDFScale3D().setScale(1, 0.75F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return MHelper.randRange(-2F, 2F, random);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -9,13 +9,13 @@ import com.google.common.collect.Lists;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
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.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;
|
||||
|
@ -42,8 +42,8 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -76,8 +76,7 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void makeCap(StructureWorldAccess world, BlockPos pos, float radius, Random random,
|
||||
OpenSimplexNoise noise) {
|
||||
private void makeCap(WorldGenLevel world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise) {
|
||||
int count = (int) radius;
|
||||
int offset = (int) (BRANCH.get(BRANCH.size() - 1).getY() * radius);
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -102,7 +101,7 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
leavesBall(world, pos.up(offset), radius * 1.15F + 2, random, noise);
|
||||
}
|
||||
|
||||
private void makeRoots(StructureWorldAccess world, BlockPos pos, float radius, Random random) {
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random) {
|
||||
int count = (int) (radius * 1.5F);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2;
|
||||
|
@ -118,8 +117,7 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private void leavesBall(StructureWorldAccess world, BlockPos pos, float radius, Random random,
|
||||
OpenSimplexNoise noise) {
|
||||
private void leavesBall(WorldGenLevel world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius)
|
||||
.setBlock(EndBlocks.DRAGON_TREE_LEAVES.defaultBlockState().with(LeavesBlock.DISTANCE, 6));
|
||||
SDF sub = new SDFScale().setScale(5).setSource(sphere);
|
||||
|
@ -127,7 +125,7 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub);
|
||||
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
|
||||
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);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return random.nextFloat() * 3F - 1.5F;
|
||||
|
|
|
@ -6,16 +6,16 @@ import java.util.function.Function;
|
|||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
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.AttachedBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -32,8 +32,8 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void makeHead(StructureWorldAccess world, BlockPos pos, int radius) {
|
||||
private void makeHead(WorldGenLevel world, BlockPos pos, int radius) {
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
if (radius < 2) {
|
||||
for (int i = -1; i < 2; i++) {
|
||||
|
|
|
@ -6,14 +6,14 @@ import java.util.Random;
|
|||
import java.util.function.Function;
|
||||
|
||||
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.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
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.HelixTreeLeavesBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -33,8 +33,8 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
BlocksHelper.setWithoutUpdate(world, pos, AIR);
|
||||
|
@ -148,7 +148,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void fillLine(Vector3f start, Vector3f end, StructureWorldAccess world, BlockState state, BlockPos pos,
|
||||
private void fillLine(Vector3f start, Vector3f end, WorldGenLevel world, BlockState state, BlockPos pos,
|
||||
int offset) {
|
||||
float dx = end.getX() - start.getX();
|
||||
float dy = end.getY() - start.getY();
|
||||
|
|
|
@ -8,12 +8,12 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.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.JellyshroomCapBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -33,8 +33,8 @@ public class JellyshroomFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class JellyshroomFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void makeRoots(StructureWorldAccess world, BlockPos pos, float radius, Random random, BlockState wood) {
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood) {
|
||||
int count = (int) (radius * 3.5F);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2;
|
||||
|
|
|
@ -7,13 +7,13 @@ import java.util.function.Function;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
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.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;
|
||||
|
@ -34,8 +34,8 @@ public class LacugroveFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@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.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -107,12 +107,11 @@ public class LacugroveFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void leavesBall(StructureWorldAccess world, BlockPos pos, float radius, Random random,
|
||||
OpenSimplexNoise noise) {
|
||||
private void leavesBall(WorldGenLevel world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius)
|
||||
.setBlock(EndBlocks.LACUGROVE_LEAVES.defaultBlockState().with(LeavesBlock.DISTANCE, 6));
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return random.nextFloat() * 3F - 1.5F;
|
||||
|
|
|
@ -9,13 +9,13 @@ import com.google.common.collect.Lists;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
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.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.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
|
@ -42,8 +42,8 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -70,8 +70,8 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void leavesBall(StructureWorldAccess world, BlockPos pos, float radius, Random random,
|
||||
OpenSimplexNoise noise, boolean natural) {
|
||||
private void leavesBall(WorldGenLevel world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise,
|
||||
boolean natural) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius)
|
||||
.setBlock(EndBlocks.LUCERNIA_LEAVES.defaultBlockState().with(LeavesBlock.DISTANCE, 6));
|
||||
SDF sub = new SDFScale().setScale(5).setSource(sphere);
|
||||
|
@ -79,7 +79,7 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub);
|
||||
sphere = new SDFScale3D().setScale(1, 0.75F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 2F;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 2F;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return MHelper.randRange(-1.5F, 1.5F, random);
|
||||
|
@ -87,7 +87,7 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
for (Direction d1 : BlocksHelper.HORIZONTAL) {
|
||||
BlockPos p = mut.set(pos).move(Direction.UP).move(d1).toImmutable();
|
||||
BlockPos p = mut.set(pos).move(Direction.UP).move(d1).immutable();
|
||||
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.LUCERNIA.bark.defaultBlockState());
|
||||
for (Direction d2 : BlocksHelper.HORIZONTAL) {
|
||||
mut.set(p).move(Direction.UP).move(d2);
|
||||
|
@ -175,7 +175,7 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
});
|
||||
}
|
||||
|
||||
private void makeRoots(StructureWorldAccess world, BlockPos pos, float radius, Random random) {
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random) {
|
||||
int count = (int) (radius * 1.5F);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2;
|
||||
|
|
|
@ -6,12 +6,12 @@ import java.util.function.Function;
|
|||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.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.MossyGlowshroomCapBlock;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
@ -48,8 +48,8 @@ public class MossyGlowshroomFeature extends DefaultFeature {
|
|||
private static final SDFPrimitive ROOTS;
|
||||
|
||||
@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) {
|
||||
BlockState down = world.getBlockState(blockPos.below());
|
||||
if (!down.is(EndBlocks.END_MYCELIUM) && !down.is(EndBlocks.END_MOSS))
|
||||
return false;
|
||||
|
|
|
@ -7,13 +7,13 @@ import java.util.function.Function;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
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.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;
|
||||
|
@ -35,8 +35,8 @@ public class PythadendronTreeFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@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()).getBlock() != EndBlocks.CHORUS_NYLIUM)
|
||||
return false;
|
||||
BlocksHelper.setWithoutUpdate(world, pos, AIR);
|
||||
|
@ -62,7 +62,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
private void branch(float x, float y, float z, float size, float angle, Random random, int depth,
|
||||
StructureWorldAccess world, BlockPos pos) {
|
||||
WorldGenLevel world, BlockPos pos) {
|
||||
if (depth == 0)
|
||||
return;
|
||||
|
||||
|
@ -113,14 +113,14 @@ public class PythadendronTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private void leavesBall(StructureWorldAccess world, BlockPos pos, Random random, OpenSimplexNoise noise) {
|
||||
private void leavesBall(WorldGenLevel world, BlockPos pos, Random random, OpenSimplexNoise noise) {
|
||||
float radius = MHelper.randRange(4.5F, 6.5F, random);
|
||||
|
||||
SDF sphere = new SDFSphere().setRadius(radius)
|
||||
.setBlock(EndBlocks.PYTHADENDRON_LEAVES.defaultBlockState().with(LeavesBlock.DISTANCE, 6));
|
||||
sphere = new SDFScale3D().setScale(1, 0.6F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return random.nextFloat() * 3F - 1.5F;
|
||||
|
|
|
@ -9,13 +9,13 @@ import com.google.common.collect.Lists;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
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.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.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.FurBlock;
|
||||
|
@ -41,8 +41,8 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> SPLINE;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -66,8 +66,7 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void leavesBall(StructureWorldAccess world, BlockPos pos, float radius, Random random,
|
||||
OpenSimplexNoise noise) {
|
||||
private void leavesBall(WorldGenLevel world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius)
|
||||
.setBlock(EndBlocks.TENANEA_LEAVES.defaultBlockState().with(LeavesBlock.DISTANCE, 6));
|
||||
SDF sub = new SDFScale().setScale(5).setSource(sphere);
|
||||
|
@ -75,7 +74,7 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub);
|
||||
sphere = new SDFScale3D().setScale(1, 0.75F, 1).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 2F;
|
||||
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 2F;
|
||||
}).setSource(sphere);
|
||||
sphere = new SDFDisplacement().setFunction((vec) -> {
|
||||
return MHelper.randRange(-1.5F, 1.5F, random);
|
||||
|
@ -83,7 +82,7 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
for (Direction d1 : BlocksHelper.HORIZONTAL) {
|
||||
BlockPos p = mut.set(pos).move(Direction.UP).move(d1).toImmutable();
|
||||
BlockPos p = mut.set(pos).move(Direction.UP).move(d1).immutable();
|
||||
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.TENANEA.bark.defaultBlockState());
|
||||
for (Direction d2 : BlocksHelper.HORIZONTAL) {
|
||||
mut.set(p).move(Direction.UP).move(d2);
|
||||
|
|
|
@ -8,14 +8,14 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
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.UmbrellaTreeClusterBlock;
|
||||
import ru.betterend.blocks.UmbrellaTreeMembraneBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -40,8 +40,8 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@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()).getBlock().isIn(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
@ -86,9 +86,9 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
sdf = (sdf == null) ? branch : new SDFUnion().setSourceA(sdf).setSourceB(branch);
|
||||
SDF mem = makeMembrane(world, radius, random, membrane, center);
|
||||
|
||||
float px = MHelper.floor(vec.getX()) + 0.5F;
|
||||
float py = MHelper.floor(vec.getY()) + 0.5F;
|
||||
float pz = MHelper.floor(vec.getZ()) + 0.5F;
|
||||
float px = MHelper.floor(vec.x()) + 0.5F;
|
||||
float py = MHelper.floor(vec.y()) + 0.5F;
|
||||
float pz = MHelper.floor(vec.z()) + 0.5F;
|
||||
mem = new SDFTranslate().setTranslate(px, py, pz).setSource(mem);
|
||||
sdf = new SDFSmoothUnion().setRadius(2).setSourceA(sdf).setSourceB(mem);
|
||||
centers.add(new Center(pos.getX() + (double) (px * scale), pos.getY() + (double) (py * scale),
|
||||
|
@ -146,7 +146,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void makeRoots(StructureWorldAccess world, BlockPos pos, float radius, Random random, BlockState wood) {
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood) {
|
||||
int count = (int) (radius * 1.5F);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2;
|
||||
|
@ -162,8 +162,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
private SDF makeMembrane(StructureWorldAccess world, float radius, Random random, BlockState membrane,
|
||||
BlockState center) {
|
||||
private SDF makeMembrane(WorldGenLevel world, float radius, Random random, BlockState membrane, BlockState center) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius).setBlock(membrane);
|
||||
SDF sub = new SDFTranslate().setTranslate(0, -4, 0).setSource(sphere);
|
||||
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub);
|
||||
|
@ -183,8 +182,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
return sphere;
|
||||
}
|
||||
|
||||
private void makeFruits(StructureWorldAccess world, double px, double py, double pz, BlockState fruit,
|
||||
float scale) {
|
||||
private void makeFruits(WorldGenLevel world, double px, double py, double pz, BlockState fruit, float scale) {
|
||||
MutableBlockPos mut = new MutableBlockPos().set(px, py, pz);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mut.move(Direction.DOWN);
|
||||
|
|
|
@ -9,8 +9,8 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||
import net.minecraft.util.math.noise.SimplexNoiseSampler;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.util.registry.RegistryLookupCodec;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeKeys;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.biome.source.TheEndBiomeSource;
|
||||
import net.minecraft.world.gen.ChunkRandom;
|
||||
|
@ -43,8 +43,8 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
|
||||
this.mapLand = new BiomeMap(seed, GeneratorOptions.getBiomeSizeLand(), EndBiomes.LAND_BIOMES);
|
||||
this.mapVoid = new BiomeMap(seed, GeneratorOptions.getBiomeSizeVoid(), EndBiomes.VOID_BIOMES);
|
||||
this.centerBiome = biomeRegistry.getOrThrow(BiomeKeys.THE_END);
|
||||
this.barrens = biomeRegistry.getOrThrow(BiomeKeys.END_BARRENS);
|
||||
this.centerBiome = biomeRegistry.getOrThrow(Biomes.THE_END);
|
||||
this.barrens = biomeRegistry.getOrThrow(Biomes.END_BARRENS);
|
||||
this.biomeRegistry = biomeRegistry;
|
||||
this.seed = seed;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
|
|
@ -16,8 +16,8 @@ public class TerrainStructureProcessor extends StructureProcessor {
|
|||
StructurePlacementData structurePlacementData) {
|
||||
BlockPos bpos = structureBlockInfo2.pos;
|
||||
if (structureBlockInfo2.state.is(Blocks.END_STONE) && worldView.isAir(bpos.up())) {
|
||||
BlockState top = worldView.getBiome(structureBlockInfo2.pos).getGenerationSettings().getSurfaceConfig()
|
||||
.getTopMaterial();
|
||||
BlockState top = worldView.getBiome(structureBlockInfo2.pos).getGenerationSettings()
|
||||
.getSurfaceBuilderConfig().getTopMaterial();
|
||||
return new StructureBlockInfo(bpos, top, structureBlockInfo2.tag);
|
||||
}
|
||||
return structureBlockInfo2;
|
||||
|
|
|
@ -4,20 +4,20 @@ import java.util.Random;
|
|||
|
||||
import net.fabricmc.fabric.api.structure.v1.FabricStructureBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class EndStructureFeature {
|
||||
private static final Random RANDOM = new Random(354);
|
||||
private final StructureFeature<DefaultFeatureConfig> structure;
|
||||
private final StructureFeature<NoneFeatureConfiguration> structure;
|
||||
private final ConfiguredStructureFeature<?, ?> featureConfigured;
|
||||
private final GenerationStep.Feature featureStep;
|
||||
|
||||
public EndStructureFeature(String name, StructureFeature<DefaultFeatureConfig> structure,
|
||||
public EndStructureFeature(String name, StructureFeature<NoneFeatureConfiguration> structure,
|
||||
GenerationStep.Feature step, int spacing, int separation) {
|
||||
ResourceLocation id = BetterEnd.makeID(name);
|
||||
|
||||
|
@ -25,12 +25,12 @@ public class EndStructureFeature {
|
|||
this.structure = FabricStructureBuilder.create(id, structure).step(step)
|
||||
.defaultConfig(spacing, separation, RANDOM.nextInt(8192)).register();
|
||||
|
||||
this.featureConfigured = this.structure.configure(DefaultFeatureConfig.DEFAULT);
|
||||
this.featureConfigured = this.structure.configure(NoneFeatureConfiguration.DEFAULT);
|
||||
|
||||
BuiltinRegistries.add(BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE, id, this.featureConfigured);
|
||||
}
|
||||
|
||||
public StructureFeature<DefaultFeatureConfig> getStructure() {
|
||||
public StructureFeature<NoneFeatureConfiguration> getStructure() {
|
||||
return structure;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.nbt.NbtHelper;
|
|||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
public class StructureWorld {
|
||||
|
@ -79,7 +79,7 @@ public class StructureWorld {
|
|||
lastPart = part;
|
||||
}
|
||||
|
||||
public boolean placeChunk(StructureWorldAccess world, ChunkPos chunkPos) {
|
||||
public boolean placeChunk(WorldGenLevel world, ChunkPos chunkPos) {
|
||||
Part part = parts.get(chunkPos);
|
||||
if (part != null) {
|
||||
Chunk chunk = world.getChunk(chunkPos.x, chunkPos.z);
|
||||
|
|
|
@ -10,12 +10,12 @@ import net.minecraft.util.math.ChunkPos;
|
|||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.gen.ChunkRandom;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.StructureHelper;
|
||||
|
@ -28,7 +28,7 @@ public class EternalPortalStructure extends FeatureBaseStructure {
|
|||
@Override
|
||||
protected boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed,
|
||||
ChunkRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
long x = chunkPos.x;
|
||||
long z = chunkPos.z;
|
||||
if (x * x + z * z < 10000) {
|
||||
|
@ -42,19 +42,19 @@ public class EternalPortalStructure extends FeatureBaseStructure {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return SDFStructureStart::new;
|
||||
}
|
||||
|
||||
public static class SDFStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public SDFStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class SDFStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public SDFStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
|
|
|
@ -7,23 +7,23 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.gen.ChunkRandom;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
|
||||
public abstract class FeatureBaseStructure extends StructureFeature<DefaultFeatureConfig> {
|
||||
public abstract class FeatureBaseStructure extends StructureFeature<NoneFeatureConfiguration> {
|
||||
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
|
||||
public FeatureBaseStructure() {
|
||||
super(DefaultFeatureConfig.CODEC);
|
||||
super(NoneFeatureConfiguration.CODEC);
|
||||
}
|
||||
|
||||
protected boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed,
|
||||
ChunkRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos,
|
||||
DefaultFeatureConfig featureConfig) {
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
return getGenerationHeight(chunkX, chunkZ, chunkGenerator) >= 20;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,16 +5,16 @@ 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.structure.StructureManager;
|
||||
import net.minecraft.structure.StructureStart;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
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.StructureFeature;
|
||||
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.StructureFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.sdf.SDF;
|
||||
|
@ -96,19 +96,19 @@ public class GiantIceStarStructure extends SDFStructureFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return StarStructureStart::new;
|
||||
}
|
||||
|
||||
public static class StarStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public StarStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class StarStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public StarStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
BlockPos start = new BlockPos(x, MHelper.randRange(32, 128, random), z);
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.betterend.world.structures.features;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import ru.betterend.blocks.MossyGlowshroomCapBlock;
|
||||
|
|
|
@ -6,28 +6,28 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
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.StructureFeature;
|
||||
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.StructureFeature;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.LakePiece;
|
||||
|
||||
public class MegaLakeSmallStructure extends FeatureBaseStructure {
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return SDFStructureStart::new;
|
||||
}
|
||||
|
||||
public static class SDFStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public SDFStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class SDFStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public SDFStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
|
|
|
@ -6,28 +6,28 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
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.StructureFeature;
|
||||
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.StructureFeature;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.LakePiece;
|
||||
|
||||
public class MegaLakeStructure extends FeatureBaseStructure {
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return SDFStructureStart::new;
|
||||
}
|
||||
|
||||
public static class SDFStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public SDFStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class SDFStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public SDFStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
|
|
|
@ -6,28 +6,28 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
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.StructureFeature;
|
||||
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.StructureFeature;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.CrystalMountainPiece;
|
||||
|
||||
public class MountainStructure extends FeatureBaseStructure {
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return SDFStructureStart::new;
|
||||
}
|
||||
|
||||
public static class SDFStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public SDFStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class SDFStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public SDFStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
|
|
|
@ -8,10 +8,10 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
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.StructureFeature;
|
||||
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.StructureFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.structures.piece.PaintedMountainPiece;
|
||||
|
@ -20,19 +20,19 @@ public class PaintedMountainStructure extends FeatureBaseStructure {
|
|||
private static final BlockState[] VARIANTS;
|
||||
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return SDFStructureStart::new;
|
||||
}
|
||||
|
||||
public static class SDFStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public SDFStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class SDFStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public SDFStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
|
|
|
@ -8,10 +8,10 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
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.StructureFeature;
|
||||
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.StructureFeature;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.sdf.SDF;
|
||||
import ru.betterend.world.structures.piece.VoxelPiece;
|
||||
|
@ -21,19 +21,19 @@ public abstract class SDFStructureFeature extends FeatureBaseStructure {
|
|||
protected abstract SDF getSDF(BlockPos pos, Random random);
|
||||
|
||||
@Override
|
||||
public StructureFeature.StructureStartFactory<DefaultFeatureConfig> getStructureStartFactory() {
|
||||
public StructureFeature.StructureStartFactory<NoneFeatureConfiguration> getStructureStartFactory() {
|
||||
return SDFStructureStart::new;
|
||||
}
|
||||
|
||||
public static class SDFStructureStart extends StructureStart<DefaultFeatureConfig> {
|
||||
public SDFStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
public static class SDFStructureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
public SDFStructureStart(StructureFeature<NoneFeatureConfiguration> feature, int chunkX, int chunkZ,
|
||||
BlockBox box, int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DynamicRegistryManager registryManager, ChunkGenerator chunkGenerator,
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, DefaultFeatureConfig config) {
|
||||
StructureManager manager, int chunkX, int chunkZ, Biome biome, NoneFeatureConfiguration config) {
|
||||
int x = (chunkX << 4) | MHelper.randRange(4, 12, random);
|
||||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
|
|
|
@ -10,9 +10,9 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -38,8 +38,8 @@ public class CavePiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, StructureAccessor arg, ChunkGenerator chunkGenerator,
|
||||
Random random, BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public boolean place(WorldGenLevel world, StructureAccessor arg, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
int x1 = MHelper.max(this.boundingBox.minX, blockBox.minX);
|
||||
int z1 = MHelper.max(this.boundingBox.minZ, blockBox.minZ);
|
||||
int x2 = MHelper.min(this.boundingBox.maxX, blockBox.maxX);
|
||||
|
|
|
@ -13,11 +13,11 @@ import net.minecraft.util.math.ChunkPos;
|
|||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
@ -29,7 +29,7 @@ public class CrystalMountainPiece extends MountainPiece {
|
|||
|
||||
public CrystalMountainPiece(BlockPos center, float radius, float height, Random random, Biome biome) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
|
||||
top = biome.getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
top = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
public CrystalMountainPiece(StructureManager manager, CompoundTag tag) {
|
||||
|
@ -39,12 +39,12 @@ public class CrystalMountainPiece extends MountainPiece {
|
|||
@Override
|
||||
protected void fromNbt(CompoundTag tag) {
|
||||
super.fromNbt(tag);
|
||||
top = EndBiomes.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
top = EndBiomes.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, StructureAccessor arg, ChunkGenerator chunkGenerator,
|
||||
Random random, BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public boolean place(WorldGenLevel world, StructureAccessor arg, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
int sx = chunkPos.getStartX();
|
||||
int sz = chunkPos.getStartZ();
|
||||
MutableBlockPos pos = new MutableBlockPos();
|
||||
|
|
|
@ -19,11 +19,11 @@ import net.minecraft.util.math.ChunkPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -83,8 +83,8 @@ public class LakePiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, StructureAccessor arg, ChunkGenerator chunkGenerator,
|
||||
Random random, BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public boolean place(WorldGenLevel world, StructureAccessor arg, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
int minY = this.boundingBox.minY;
|
||||
int maxY = this.boundingBox.maxY;
|
||||
int sx = chunkPos.x << 4;
|
||||
|
@ -130,7 +130,7 @@ public class LakePiece extends BasePiece {
|
|||
state = chunk.getBlockState(mut.up());
|
||||
if (state.isAir()) {
|
||||
state = random.nextBoolean() ? ENDSTONE
|
||||
: world.getBiome(worldPos).getGenerationSettings().getSurfaceConfig()
|
||||
: world.getBiome(worldPos).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
} else {
|
||||
state = state.getFluidState().isEmpty() ? ENDSTONE
|
||||
|
@ -146,7 +146,7 @@ public class LakePiece extends BasePiece {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void fixWater(StructureWorldAccess world, Chunk chunk, MutableBlockPos mut, Random random, int sx, int sz) {
|
||||
private void fixWater(WorldGenLevel world, Chunk chunk, MutableBlockPos mut, Random random, int sx, int sz) {
|
||||
int minY = this.boundingBox.minY;
|
||||
int maxY = this.boundingBox.maxY;
|
||||
for (int x = 0; x < 16; x++) {
|
||||
|
@ -164,8 +164,8 @@ public class LakePiece extends BasePiece {
|
|||
BlockState bState = chunk.getBlockState(mut);
|
||||
if (bState.isAir()) {
|
||||
bState = random.nextBoolean() ? ENDSTONE
|
||||
: world.getBiome(mut.add(sx, 0, sz)).getGenerationSettings().getSurfaceConfig()
|
||||
.getTopMaterial();
|
||||
: world.getBiome(mut.add(sx, 0, sz)).getGenerationSettings()
|
||||
.getSurfaceBuilderConfig().getTopMaterial();
|
||||
} else {
|
||||
bState = bState.getFluidState().isEmpty() ? ENDSTONE
|
||||
: EndBlocks.ENDSTONE_DUST.defaultBlockState();
|
||||
|
@ -184,7 +184,7 @@ public class LakePiece extends BasePiece {
|
|||
if (bState.isAir()) {
|
||||
bState = random.nextBoolean() ? ENDSTONE
|
||||
: world.getBiome(mut.add(sx, 0, sz)).getGenerationSettings()
|
||||
.getSurfaceConfig().getTopMaterial();
|
||||
.getSurfaceBuilderConfig().getTopMaterial();
|
||||
} else {
|
||||
bState = bState.getFluidState().isEmpty() ? ENDSTONE
|
||||
: EndBlocks.ENDSTONE_DUST.defaultBlockState();
|
||||
|
@ -212,7 +212,7 @@ public class LakePiece extends BasePiece {
|
|||
}
|
||||
}
|
||||
|
||||
private int getHeight(StructureWorldAccess world, BlockPos pos) {
|
||||
private int getHeight(WorldGenLevel world, BlockPos pos) {
|
||||
int p = ((pos.getX() & 2047) << 11) | (pos.getZ() & 2047);
|
||||
int h = heightmap.getOrDefault(p, Byte.MIN_VALUE);
|
||||
if (h > Byte.MIN_VALUE) {
|
||||
|
@ -224,7 +224,7 @@ public class LakePiece extends BasePiece {
|
|||
return 0;
|
||||
}
|
||||
|
||||
h = world.getTopY(Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
h = world.getHeight(Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
h = Mth.abs(h - center.getY());
|
||||
h = h < 8 ? 1 : 0;
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class LakePiece extends BasePiece {
|
|||
return h;
|
||||
}
|
||||
|
||||
private float getHeightClamp(StructureWorldAccess world, int radius, int posX, int posZ) {
|
||||
private float getHeightClamp(WorldGenLevel world, int radius, int posX, int posZ) {
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
int r2 = radius * radius;
|
||||
float height = 0;
|
||||
|
|
|
@ -15,8 +15,8 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
@ -76,7 +76,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
noise2 = new OpenSimplexNoise(seed2);
|
||||
}
|
||||
|
||||
private int getHeight(StructureWorldAccess world, BlockPos pos) {
|
||||
private int getHeight(WorldGenLevel world, BlockPos pos) {
|
||||
int p = ((pos.getX() & 2047) << 11) | (pos.getZ() & 2047);
|
||||
int h = heightmap.getOrDefault(p, Integer.MIN_VALUE);
|
||||
if (h > Integer.MIN_VALUE) {
|
||||
|
@ -87,7 +87,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
heightmap.put(p, -10);
|
||||
return -10;
|
||||
}
|
||||
h = world.getTopY(Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
h = world.getHeight(Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
h = Mth.abs(h - center.getY());
|
||||
if (h > 4) {
|
||||
h = 4 - h;
|
||||
|
@ -108,7 +108,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
return h;
|
||||
}
|
||||
|
||||
protected float getHeightClamp(StructureWorldAccess world, int radius, int posX, int posZ) {
|
||||
protected float getHeightClamp(WorldGenLevel world, int radius, int posX, int posZ) {
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
float height = 0;
|
||||
float max = 0;
|
||||
|
|
|
@ -13,9 +13,9 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.StructureHelper;
|
||||
|
@ -69,8 +69,8 @@ public class NBTPiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, StructureAccessor arg, ChunkGenerator chunkGenerator,
|
||||
Random random, BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public boolean place(WorldGenLevel world, StructureAccessor arg, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
BlockBox bounds = new BlockBox(blockBox);
|
||||
bounds.maxY = this.boundingBox.maxY;
|
||||
bounds.minY = this.boundingBox.minY;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue