Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,14 +1,11 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
||||
|
@ -38,7 +35,8 @@ public class BiomeIslandFeature extends DefaultFeature {
|
|||
BlockState topMaterial = surfaceConfig.getTopMaterial();
|
||||
if (BlocksHelper.isFluid(topMaterial)) {
|
||||
topBlock = ((SurfaceBuilderBaseConfiguration) surfaceConfig).getUnderwaterMaterial();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
topBlock = topMaterial;
|
||||
}
|
||||
underBlock = surfaceConfig.getUnderMaterial();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -9,9 +7,11 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlueVineFeature extends ScatterFeature {
|
||||
private boolean small;
|
||||
|
||||
|
||||
public BlueVineFeature() {
|
||||
super(5);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -13,6 +10,8 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.blocks.EndBlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CavePumpkinFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -6,7 +6,7 @@ public class CharniaFeature extends UnderwaterPlantFeature {
|
|||
public CharniaFeature(Block plant) {
|
||||
super(plant, 6);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 3;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
|
@ -10,7 +8,6 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
|
@ -27,6 +24,8 @@ import ru.bclib.util.StructureHelper;
|
|||
import ru.bclib.world.features.NBTStructureFeature;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CrashedShipFeature extends NBTStructureFeature {
|
||||
private static final StructureProcessor REPLACER;
|
||||
private static final String STRUCTURE_PATH = "/data/minecraft/structures/end_city/ship.nbt";
|
||||
|
@ -117,8 +116,8 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
REPLACER = new StructureProcessor() {
|
||||
@Override
|
||||
public StructureBlockInfo processBlock(LevelReader worldView, BlockPos pos, BlockPos blockPos,
|
||||
StructureBlockInfo structureBlockInfo, StructureBlockInfo structureBlockInfo2,
|
||||
StructurePlaceSettings structurePlacementData) {
|
||||
StructureBlockInfo structureBlockInfo, StructureBlockInfo structureBlockInfo2,
|
||||
StructurePlaceSettings structurePlacementData) {
|
||||
BlockState state = structureBlockInfo2.state;
|
||||
if (state.is(Blocks.SPAWNER) || state.getMaterial().equals(Material.WOOL)) {
|
||||
return new StructureBlockInfo(structureBlockInfo2.pos, AIR, null);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -10,17 +8,19 @@ import ru.bclib.blocks.BaseDoublePlantBlock;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DoublePlantFeature extends ScatterFeature {
|
||||
private final Block smallPlant;
|
||||
private final Block largePlant;
|
||||
private Block plant;
|
||||
|
||||
|
||||
public DoublePlantFeature(Block smallPlant, Block largePlant, int radius) {
|
||||
super(radius);
|
||||
this.smallPlant = smallPlant;
|
||||
this.largePlant = largePlant;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.EndLilySeedBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EndLilyFeature extends UnderwaterPlantScatter {
|
||||
public EndLilyFeature(int radius) {
|
||||
super(radius);
|
||||
|
@ -17,7 +17,7 @@ public class EndLilyFeature extends UnderwaterPlantScatter {
|
|||
EndLilySeedBlock seed = (EndLilySeedBlock) EndBlocks.END_LILY_SEED;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 15;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.EndLotusSeedBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EndLotusFeature extends UnderwaterPlantScatter {
|
||||
public EndLotusFeature(int radius) {
|
||||
super(radius);
|
||||
|
@ -17,7 +17,7 @@ public class EndLotusFeature extends UnderwaterPlantScatter {
|
|||
EndLotusSeedBlock seed = (EndLotusSeedBlock) EndBlocks.END_LOTUS_SEED;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 15;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -13,6 +11,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.betterend.blocks.EndLotusLeafBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EndLotusLeafFeature extends ScatterFeature {
|
||||
public EndLotusLeafFeature(int radius) {
|
||||
super(radius);
|
||||
|
@ -24,41 +24,41 @@ public class EndLotusLeafFeature extends ScatterFeature {
|
|||
generateLeaf(world, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return getPosOnSurface(world, pos);
|
||||
}
|
||||
|
||||
|
||||
private void generateLeaf(WorldGenLevel world, BlockPos pos) {
|
||||
MutableBlockPos p = new MutableBlockPos();
|
||||
BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, leaf.setValue(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM));
|
||||
for (Direction move: BlocksHelper.HORIZONTAL) {
|
||||
for (Direction move : BlocksHelper.HORIZONTAL) {
|
||||
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, move).setValue(EndLotusLeafBlock.SHAPE, TripleShape.MIDDLE));
|
||||
}
|
||||
for (int i = 0; i < 4; i ++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Direction d1 = BlocksHelper.HORIZONTAL[i];
|
||||
Direction d2 = BlocksHelper.HORIZONTAL[(i + 1) & 3];
|
||||
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(d1).move(d2), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, d1).setValue(EndLotusLeafBlock.SHAPE, TripleShape.TOP));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean canGenerate(WorldGenLevel world, BlockPos pos) {
|
||||
MutableBlockPos p = new MutableBlockPos();
|
||||
p.setY(pos.getY());
|
||||
int count = 0;
|
||||
for (int x = -1; x < 2; x ++) {
|
||||
for (int x = -1; x < 2; x++) {
|
||||
p.setX(pos.getX() + x);
|
||||
for (int z = -1; z < 2; z ++) {
|
||||
for (int z = -1; z < 2; z++) {
|
||||
p.setZ(pos.getZ() + z);
|
||||
if (world.isEmptyBlock(p) && world.getBlockState(p.below()).is(Blocks.WATER))
|
||||
count ++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count == 9;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -13,6 +11,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FilaluxFeature extends SkyScatterFeature {
|
||||
public FilaluxFeature() {
|
||||
super(10);
|
||||
|
@ -24,7 +24,7 @@ public class FilaluxFeature extends SkyScatterFeature {
|
|||
BlockState wings = EndBlocks.FILALUX_WINGS.defaultBlockState();
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.FILALUX_LANTERN);
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos.above(), wings.setValue(BlockStateProperties.FACING, Direction.UP));
|
||||
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos.relative(dir), wings.setValue(BlockStateProperties.FACING, dir));
|
||||
}
|
||||
int length = MHelper.randRange(1, 3, random);
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
@ -13,6 +10,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class FullHeightScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
private final int radius;
|
||||
|
@ -22,7 +21,7 @@ public abstract class FullHeightScatterFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
float radius);
|
||||
|
||||
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class GlowPillarFeature extends ScatterFeature {
|
||||
public GlowPillarFeature() {
|
||||
super(9);
|
||||
|
@ -22,7 +22,7 @@ public class GlowPillarFeature extends ScatterFeature {
|
|||
EndPlantWithAgeBlock seed = ((EndPlantWithAgeBlock) EndBlocks.GLOWING_PILLAR_SEED);
|
||||
seed.growAdult(world, random, blockPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 10;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.HydraluxSaplingBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class HydraluxFeature extends UnderwaterPlantScatter {
|
||||
public HydraluxFeature(int radius) {
|
||||
super(radius);
|
||||
|
@ -17,7 +17,7 @@ public class HydraluxFeature extends UnderwaterPlantScatter {
|
|||
HydraluxSaplingBlock seed = (HydraluxSaplingBlock) EndBlocks.HYDRALUX_SAPLING;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 15;
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
@ -13,6 +10,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class InvertedScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
private final int radius;
|
||||
|
@ -22,7 +21,7 @@ public abstract class InvertedScatterFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
float radius);
|
||||
|
||||
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class LanceleafFeature extends ScatterFeature {
|
||||
public LanceleafFeature() {
|
||||
super(7);
|
||||
|
@ -22,7 +22,7 @@ public class LanceleafFeature extends ScatterFeature {
|
|||
EndPlantWithAgeBlock seed = ((EndPlantWithAgeBlock) EndBlocks.LANCELEAF_SEED);
|
||||
seed.growAdult(world, random, blockPos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 5;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -10,9 +7,12 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class MengerSpongeFeature extends UnderwaterPlantScatter {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
||||
|
||||
public MengerSpongeFeature(int radius) {
|
||||
super(radius);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class MengerSpongeFeature extends UnderwaterPlantScatter {
|
|||
public void generate(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.MENGER_SPONGE_WET);
|
||||
if (random.nextBoolean()) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
BlockPos pos = blockPos.relative(dir);
|
||||
if (REPLACE.apply(world.getBlockState(pos))) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.MENGER_SPONGE_WET);
|
||||
|
@ -29,7 +29,7 @@ public class MengerSpongeFeature extends UnderwaterPlantScatter {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
REPLACE = (state) -> {
|
||||
if (state.is(EndBlocks.END_LOTUS_STEM)) {
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.NeonCactusPlantBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class NeonCactusFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
@ -22,7 +21,7 @@ public class NeonCactusFeature extends DefaultFeature {
|
|||
if (!ground.is(EndBlocks.ENDSTONE_DUST) && !ground.is(EndBlocks.END_MOSS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
NeonCactusPlantBlock cactus = ((NeonCactusPlantBlock) EndBlocks.NEON_CACTUS);
|
||||
cactus.growPlant(world, pos, random);
|
||||
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -13,6 +10,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class ScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
private final int radius;
|
||||
|
@ -22,7 +21,7 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
float radius);
|
||||
|
||||
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
|
@ -33,7 +32,8 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
if (pos.getY() < 5) {
|
||||
return false;
|
||||
} else if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
}
|
||||
else if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -9,7 +7,6 @@ import net.minecraft.tags.BlockTags;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
@ -18,6 +15,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SilkMothNestFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -11,9 +9,11 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|||
import ru.bclib.blocks.BaseAttachedBlock;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SingleInvertedScatterFeature extends InvertedScatterFeature {
|
||||
private final Block block;
|
||||
|
||||
|
||||
public SingleInvertedScatterFeature(Block block, int radius) {
|
||||
super(radius);
|
||||
this.block = block;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -11,39 +9,41 @@ import ru.bclib.blocks.BaseDoublePlantBlock;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SinglePlantFeature extends ScatterFeature {
|
||||
private final Block plant;
|
||||
private final boolean rawHeightmap;
|
||||
private final int chance;
|
||||
|
||||
|
||||
public SinglePlantFeature(Block plant, int radius) {
|
||||
this(plant, radius, true, 1);
|
||||
}
|
||||
|
||||
|
||||
public SinglePlantFeature(Block plant, int radius, int chance) {
|
||||
this(plant, radius, true, chance);
|
||||
}
|
||||
|
||||
|
||||
public SinglePlantFeature(Block plant, int radius, boolean rawHeightmap) {
|
||||
this(plant, radius, rawHeightmap, 1);
|
||||
}
|
||||
|
||||
|
||||
public SinglePlantFeature(Block plant, int radius, boolean rawHeightmap, int chance) {
|
||||
super(radius);
|
||||
this.plant = plant;
|
||||
this.rawHeightmap = rawHeightmap;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
|
||||
protected int getChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return rawHeightmap ? getPosOnSurfaceWG(world, pos) : getPosOnSurface(world, pos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return plant.canSurvive(plant.defaultBlockState(), world, blockPos);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -9,11 +7,13 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class SkyScatterFeature extends ScatterFeature {
|
||||
public SkyScatterFeature(int radius) {
|
||||
super(radius);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 10;
|
||||
|
@ -24,29 +24,29 @@ public abstract class SkyScatterFeature extends ScatterFeature {
|
|||
if (!world.isEmptyBlock(blockPos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||
|
||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
||||
if (!world.isEmptyBlock(blockPos.relative(dir))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int maxD = getYOffset() + 2;
|
||||
int maxV = getYOffset() - 2;
|
||||
|
||||
|
||||
return BlocksHelper.upRay(world, blockPos, maxD) > maxV && BlocksHelper.downRay(world, blockPos, maxD) > maxV;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return new BlockPos(pos.getX(), MHelper.randRange(32, 192, world.getRandom()), pos.getZ());
|
||||
}
|
||||
|
||||
|
||||
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
|
||||
pos.setY(pos.getY() + MHelper.randRange(-getYOffset(), getYOffset(), world.getRandom()));
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -9,14 +7,16 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import ru.bclib.blocks.BaseDoublePlantBlock;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class UnderwaterPlantFeature extends UnderwaterPlantScatter {
|
||||
private final Block plant;
|
||||
|
||||
|
||||
public UnderwaterPlantFeature(Block plant, int radius) {
|
||||
super(radius);
|
||||
this.plant = plant;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return super.canSpawn(world, blockPos) && plant.canSurvive(plant.defaultBlockState(), world, blockPos);
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class UnderwaterPlantScatter extends ScatterFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
|
||||
public UnderwaterPlantScatter(int radius) {
|
||||
super(radius);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
POS.setX(pos.getX());
|
||||
|
@ -21,32 +21,32 @@ public abstract class UnderwaterPlantScatter extends ScatterFeature {
|
|||
POS.setY(0);
|
||||
return getGround(world, POS).immutable();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
return world.getBlockState(blockPos).is(Blocks.WATER);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
return world.getBlockState(pos).is(Blocks.WATER);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
|
||||
return getGround(world, pos).getY() < 128;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getYOffset() {
|
||||
return -5;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
private BlockPos getGround(WorldGenLevel world, MutableBlockPos pos) {
|
||||
while (pos.getY() < 128 && world.getFluidState(pos).isEmpty()) {
|
||||
pos.setY(pos.getY() + 1);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -11,11 +9,13 @@ import ru.bclib.blocks.BlockProperties;
|
|||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class VineFeature extends InvertedScatterFeature {
|
||||
private final Block vineBlock;
|
||||
private final int maxLength;
|
||||
private final boolean vine;
|
||||
|
||||
|
||||
public VineFeature(Block vineBlock, int maxLength) {
|
||||
super(6);
|
||||
this.vineBlock = vineBlock;
|
||||
|
@ -43,7 +43,7 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
BlocksHelper.setWithoutUpdate(world, blockPos.below(h), bottom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean canPlaceBlock(BlockState state, WorldGenLevel world, BlockPos blockPos) {
|
||||
if (vine) {
|
||||
return ((BaseVineBlock) vineBlock).canGenerate(state, world, blockPos);
|
||||
|
@ -52,17 +52,17 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
return vineBlock.canSurvive(state, world, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private BlockState getTopState() {
|
||||
BlockState state = vineBlock.defaultBlockState();
|
||||
return vine ? state.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP) : state;
|
||||
}
|
||||
|
||||
|
||||
private BlockState getMiggleState() {
|
||||
BlockState state = vineBlock.defaultBlockState();
|
||||
return vine ? state.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE) : state;
|
||||
}
|
||||
|
||||
|
||||
private BlockState getBottomState() {
|
||||
BlockState state = vineBlock.defaultBlockState();
|
||||
return vine ? state.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM) : state;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -12,9 +10,11 @@ import ru.bclib.blocks.BaseAttachedBlock;
|
|||
import ru.bclib.blocks.BaseWallPlantBlock;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class WallPlantFeature extends WallScatterFeature {
|
||||
private final Block block;
|
||||
|
||||
|
||||
public WallPlantFeature(Block block, int radius) {
|
||||
super(radius);
|
||||
this.block = block;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -9,6 +7,8 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class WallPlantOnLogFeature extends WallPlantFeature {
|
||||
public WallPlantOnLogFeature(Block block, int radius) {
|
||||
super(block, radius);
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
@ -14,6 +11,8 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class WallScatterFeature extends DefaultFeature {
|
||||
private static final Direction[] DIR = BlocksHelper.makeHorizontal();
|
||||
private final int radius;
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package ru.betterend.world.features.bushes;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -25,6 +21,9 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BushFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private final Block leaves;
|
||||
|
@ -62,7 +61,8 @@ public class BushFeature extends DefaultFeature {
|
|||
int distance = info.getPos().distManhattan(pos);
|
||||
if (distance < 7) {
|
||||
return info.getState().setValue(LeavesBlock.DISTANCE, distance);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return AIR;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,8 @@ public class BushFeature extends DefaultFeature {
|
|||
if (leaves instanceof LeavesBlock) {
|
||||
BlocksHelper.setWithoutUpdate(world, p,
|
||||
leaves.defaultBlockState().setValue(LeavesBlock.DISTANCE, 1));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, p, leaves.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.world.features.bushes;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -10,7 +7,6 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -26,6 +22,9 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BushWithOuterFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
@ -66,7 +65,8 @@ public class BushWithOuterFeature extends DefaultFeature {
|
|||
int distance = info.getPos().distManhattan(pos);
|
||||
if (distance < 7) {
|
||||
return info.getState().setValue(LeavesBlock.DISTANCE, distance);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return AIR;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,8 @@ public class BushWithOuterFeature extends DefaultFeature {
|
|||
if (leaves instanceof LeavesBlock) {
|
||||
BlocksHelper.setWithoutUpdate(world, p,
|
||||
leaves.defaultBlockState().setValue(LeavesBlock.DISTANCE, 1));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, p, leaves.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package ru.betterend.world.features.bushes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -18,6 +15,8 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class LargeAmaranitaFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package ru.betterend.world.features.bushes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -18,6 +15,8 @@ import ru.betterend.blocks.EndBlockProperties.LumecornShape;
|
|||
import ru.betterend.blocks.LumecornBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Lumecorn extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
@ -54,7 +53,8 @@ public class Lumecorn extends DefaultFeature {
|
|||
if (random.nextBoolean()) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut,
|
||||
EndBlocks.LUMECORN.defaultBlockState().setValue(LumecornBlock.SHAPE, LumecornShape.BOTTOM_SMALL));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut,
|
||||
EndBlocks.LUMECORN.defaultBlockState().setValue(LumecornBlock.SHAPE, LumecornShape.BOTTOM_BIG));
|
||||
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP),
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
package ru.betterend.world.features.bushes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -32,6 +26,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TenaneaBushFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
|
@ -78,7 +76,8 @@ public class TenaneaBushFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
return info.getState().setValue(LeavesBlock.DISTANCE, distance);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return AIR;
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +111,8 @@ public class TenaneaBushFeature extends DefaultFeature {
|
|||
mut.setY(mut.getY() - 1);
|
||||
if (world.isEmptyBlock(mut.below())) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, middle);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -19,6 +15,8 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
|
@ -20,6 +17,8 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DesertLakeFeature extends DefaultFeature {
|
||||
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -23,6 +19,8 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FallenPillarFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -21,6 +17,9 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class FloatingSpireFeature extends SpireFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
@ -58,7 +57,8 @@ public class FloatingSpireFeature extends SpireFeature {
|
|||
support.add(info.getPos().above());
|
||||
}
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
} else if (info.getState(Direction.UP, 3).isAir()) {
|
||||
}
|
||||
else if (info.getState(Direction.UP, 3).isAir()) {
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getUnderMaterial();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -41,6 +37,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GeyserFeature extends DefaultFeature {
|
||||
protected static final Function<BlockState, Boolean> REPLACE1;
|
||||
protected static final Function<BlockState, Boolean> REPLACE2;
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.sdf.SDF;
|
||||
|
@ -21,6 +15,10 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class IceStarFeature extends DefaultFeature {
|
||||
private final float minSize;
|
||||
private final float maxSize;
|
||||
|
@ -53,7 +51,8 @@ public class IceStarFeature extends DefaultFeature {
|
|||
if (angle > 0.01F && angle < 3.14F) {
|
||||
Vector3f axis = MHelper.normalize(MHelper.cross(Vector3f.YP, point));
|
||||
rotated = new SDFRotation().setRotation(axis, angle).setSource(spike);
|
||||
} else if (angle > 1) {
|
||||
}
|
||||
else if (angle > 1) {
|
||||
rotated = new SDFRotation().setRotation(Vector3f.YP, (float) Math.PI).setSource(spike);
|
||||
}
|
||||
sdf = (sdf == null) ? rotated : new SDFUnion().setSourceA(sdf).setSourceB(rotated);
|
||||
|
@ -83,9 +82,11 @@ public class IceStarFeature extends DefaultFeature {
|
|||
+ random.nextFloat() * randScale;
|
||||
if (distance < ancientRadius) {
|
||||
return ancient;
|
||||
} else if (distance < denseRadius) {
|
||||
}
|
||||
else if (distance < denseRadius) {
|
||||
return dense;
|
||||
} else if (distance < iceRadius) {
|
||||
}
|
||||
else if (distance < iceRadius) {
|
||||
return ice;
|
||||
}
|
||||
return info.getState();
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -20,6 +17,8 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ObsidianBoulderFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.sdf.SDF;
|
||||
|
@ -17,6 +14,8 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class OreLayerFeature extends DefaultFeature {
|
||||
private static final SDFSphere SPHERE;
|
||||
private static final SDFCoordModify NOISE;
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SingleBlockFeature extends DefaultFeature {
|
||||
private final Block block;
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -16,6 +13,8 @@ import ru.bclib.util.MHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -29,6 +24,10 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SpireFeature extends DefaultFeature {
|
||||
protected static final Function<BlockState, Boolean> REPLACE;
|
||||
|
||||
|
@ -63,7 +62,8 @@ public class SpireFeature extends DefaultFeature {
|
|||
support.add(info.getPos().above());
|
||||
}
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
} else if (info.getState(Direction.UP, 3).isAir()) {
|
||||
}
|
||||
else if (info.getState(Direction.UP, 3).isAir()) {
|
||||
return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig()
|
||||
.getUnderMaterial();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -9,7 +7,6 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -17,6 +14,8 @@ import ru.bclib.blocks.StalactiteBlock;
|
|||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class StalactiteFeature extends DefaultFeature {
|
||||
private final boolean ceiling;
|
||||
private final Block[] ground;
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
|
@ -18,6 +15,8 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SulphurHillFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
|
@ -80,7 +79,8 @@ public class SulphurHillFeature extends DefaultFeature {
|
|||
BlocksHelper.setWithoutUpdate(world, mut, rock);
|
||||
mut.move(Direction.DOWN);
|
||||
}
|
||||
} else if (d < r1 * r1) {
|
||||
}
|
||||
else if (d < r1 * r1) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, brimstone);
|
||||
mut.move(Direction.DOWN);
|
||||
state = world.getBlockState(mut);
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -12,7 +8,6 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
@ -27,6 +22,9 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class SulphuricCaveFeature extends DefaultFeature {
|
||||
private static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
@ -104,14 +102,16 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
if (isReplaceable(state)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, y < waterLevel ? WATER : CAVE_AIR);
|
||||
}
|
||||
} else if (dist < r2 * r2) {
|
||||
}
|
||||
else if (dist < r2 * r2) {
|
||||
state = world.getBlockState(mut);
|
||||
if (state.is(TagAPI.GEN_TERRAIN) || state.is(Blocks.AIR)) {
|
||||
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.immutable());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, rock);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
brimstone.add(POS.below(2));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!isAbsoluteBorder(world, POS)) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
|
||||
world.getLiquidTicks().scheduleTick(POS, Fluids.WATER, 0);
|
||||
|
@ -82,14 +83,16 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
brimstone.add(POS.below(3));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
brimstone.add(POS.immutable());
|
||||
if (random.nextBoolean()) {
|
||||
brimstone.add(POS.below());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.WATER);
|
||||
brimstone.remove(POS);
|
||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
||||
|
@ -117,7 +120,8 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dist < r2) {
|
||||
}
|
||||
else if (dist < r2) {
|
||||
POS.setY(getYOnSurface(world, x, z) - 1);
|
||||
if (world.getBlockState(POS).is(TagAPI.GEN_TERRAIN)) {
|
||||
brimstone.add(POS.immutable());
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
package ru.betterend.world.features.terrain.caves;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
@ -22,6 +16,10 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class CaveChunkPopulatorFeature extends DefaultFeature {
|
||||
private Supplier<EndCaveBiome> supplier;
|
||||
|
||||
|
@ -50,7 +48,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
protected void fillSets(int sx, int sz, ChunkAccess chunk, Set<BlockPos> floorPositions,
|
||||
Set<BlockPos> ceilPositions, MutableBlockPos min, MutableBlockPos max) {
|
||||
Set<BlockPos> ceilPositions, MutableBlockPos min, MutableBlockPos max) {
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
MutableBlockPos mut2 = new MutableBlockPos();
|
||||
MutableBlockPos mut3 = new MutableBlockPos();
|
||||
|
@ -108,7 +106,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
protected void placeFloor(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> floorPositions, Random random,
|
||||
BlockState surfaceBlock) {
|
||||
BlockState surfaceBlock) {
|
||||
float density = biome.getFloorDensity();
|
||||
floorPositions.forEach((pos) -> {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
||||
|
|
|
@ -117,14 +117,14 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void placeWalls(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> positions, Random random) {
|
||||
Set<BlockPos> placed = Sets.newHashSet();
|
||||
positions.forEach(pos -> {
|
||||
if (random.nextInt(4) == 0 && hasOpenSide(pos, positions)) {
|
||||
BlockState wallBlock = biome.getWall(pos);
|
||||
if (wallBlock != null) {
|
||||
for (Vec3i offset: SPHERE) {
|
||||
for (Vec3i offset : SPHERE) {
|
||||
BlockPos wallPos = pos.offset(offset);
|
||||
if (!positions.contains(wallPos) && !placed.contains(wallPos) && world.getBlockState(wallPos).is(TagAPI.GEN_TERRAIN)) {
|
||||
wallBlock = biome.getWall(wallPos);
|
||||
|
@ -136,9 +136,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private boolean hasOpenSide(BlockPos pos, Set<BlockPos> positions) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
if (!positions.contains(pos.relative(dir))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected boolean biomeMissingCaves(WorldGenLevel world, BlockPos pos) {
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
|
@ -239,7 +239,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
List<Vec3i> prePos = Lists.newArrayList();
|
||||
int radius = 5;
|
||||
|
@ -256,6 +256,6 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
}
|
||||
SPHERE = prePos.toArray(new Vec3i[] {});
|
||||
SPHERE = prePos.toArray(new Vec3i[]{});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package ru.betterend.world.features.terrain.caves;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -16,21 +11,25 @@ import ru.bclib.util.BlocksHelper;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class RoundCaveFeature extends EndCaveFeature {
|
||||
@Override
|
||||
protected Set<BlockPos> generate(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;
|
||||
int z1 = center.getZ() - radius - 5;
|
||||
int x2 = center.getX() + radius + 5;
|
||||
int z2 = center.getZ() + radius + 5;
|
||||
int y1 = MHelper.floor(center.getY() - (radius + 5) / 1.6);
|
||||
int y2 = MHelper.floor(center.getY() + (radius + 5) / 1.6);
|
||||
|
||||
|
||||
double hr = radius * 0.75;
|
||||
double nr = radius * 0.25;
|
||||
|
||||
|
||||
int dx = x2 - x1 + 1;
|
||||
int dz = z2 - z1 + 1;
|
||||
int count = dx * dz;
|
||||
|
@ -54,12 +53,12 @@ public class RoundCaveFeature extends EndCaveFeature {
|
|||
state = world.getBlockState(bpos);
|
||||
if (isReplaceable(state) && !isWaterNear(world, bpos)) {
|
||||
blocks.add(bpos.immutable());
|
||||
|
||||
|
||||
while (state.getMaterial().equals(Material.LEAVES)) {
|
||||
bpos.setY(bpos.getY() + 1);
|
||||
state = world.getBlockState(bpos);
|
||||
}
|
||||
|
||||
|
||||
bpos.setY(y - 1);
|
||||
while (state.getMaterial().equals(Material.LEAVES)) {
|
||||
bpos.setY(bpos.getY() - 1);
|
||||
|
@ -70,10 +69,10 @@ public class RoundCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
});
|
||||
blocks.forEach(bpos -> BlocksHelper.setWithoutUpdate(world, bpos, CAVE_AIR));
|
||||
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
|
||||
private boolean isReplaceable(BlockState state) {
|
||||
return state.is(TagAPI.GEN_TERRAIN)
|
||||
|| state.getMaterial().isReplaceable()
|
||||
|
|
|
@ -35,24 +35,24 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
if ((long) cx * (long) cx + (long) cz + (long) cz < 256) {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
|
||||
|
||||
int x1 = cx << 4;
|
||||
int z1 = cz << 4;
|
||||
int x2 = x1 + 16;
|
||||
int z2 = z1 + 16;
|
||||
|
||||
|
||||
Random rand = new Random(world.getSeed());
|
||||
OpenSimplexNoise noiseH = new OpenSimplexNoise(rand.nextInt());
|
||||
OpenSimplexNoise noiseV = new OpenSimplexNoise(rand.nextInt());
|
||||
OpenSimplexNoise noiseD = new OpenSimplexNoise(rand.nextInt());
|
||||
|
||||
|
||||
Set<BlockPos> positions = Sets.newConcurrentHashSet();
|
||||
|
||||
|
||||
float a = hasCaves(world, new BlockPos(x1, 0, z1)) ? 1F : 0F;
|
||||
float b = hasCaves(world, new BlockPos(x2, 0, z1)) ? 1F : 0F;
|
||||
float c = hasCaves(world, new BlockPos(x1, 0, z2)) ? 1F : 0F;
|
||||
float d = hasCaves(world, new BlockPos(x2, 0, z2)) ? 1F : 0F;
|
||||
|
||||
|
||||
ChunkAccess chunk = world.getChunk(cx, cz);
|
||||
IntStream.range(0, 256).parallel().forEach(index -> {
|
||||
MutableBlockPos pos = new MutableBlockPos();
|
||||
|
@ -84,17 +84,17 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
});
|
||||
positions.forEach(bpos -> BlocksHelper.setWithoutUpdate(world, bpos, CAVE_AIR));
|
||||
|
||||
|
||||
return positions;
|
||||
}
|
||||
|
||||
|
||||
private boolean noWaterNear(WorldGenLevel world, BlockPos pos) {
|
||||
BlockPos above1 = pos.above();
|
||||
BlockPos above2 = pos.above(2);
|
||||
if (!world.getFluidState(above1).isEmpty() || !world.getFluidState(above2).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
||||
if (!world.getFluidState(above1.relative(dir)).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
|
@ -117,12 +117,12 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
if (biomeMissingCaves(world, pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Set<BlockPos> caveBlocks = generate(world, pos, random);
|
||||
if (caveBlocks.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Map<EndCaveBiome, Set<BlockPos>> floorSets = Maps.newHashMap();
|
||||
Map<EndCaveBiome, Set<BlockPos>> ceilSets = Maps.newHashMap();
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
|
@ -157,11 +157,11 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
});
|
||||
caveBlocks.removeAll(remove);
|
||||
|
||||
|
||||
if (caveBlocks.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
floorSets.forEach((biome, floorPositions) -> {
|
||||
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||
|
@ -180,7 +180,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
protected Set<BlockPos> generate(WorldGenLevel world, BlockPos center, int radius, Random random) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void placeFloor(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> floorPositions, Random random, BlockState surfaceBlock) {
|
||||
float density = biome.getFloorDensity() * 0.2F;
|
||||
|
@ -213,14 +213,14 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected boolean hasCaves(WorldGenLevel world, BlockPos pos) {
|
||||
return hasCavesInBiome(world, pos.offset(-8, 0, -8)) &&
|
||||
hasCavesInBiome(world, pos.offset(8, 0, -8)) &&
|
||||
hasCavesInBiome(world, pos.offset(-8, 0, 8)) &&
|
||||
hasCavesInBiome(world, pos.offset(8, 0, 8));
|
||||
}
|
||||
|
||||
|
||||
protected boolean hasCavesInBiome(WorldGenLevel world, BlockPos pos) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
BCLBiome endBiome = BiomeAPI.getFromBiome(biome);
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -33,6 +27,10 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class DragonTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Function<BlockState, Boolean> IGNORE;
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -14,7 +9,6 @@ import net.minecraft.core.Direction.AxisDirection;
|
|||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -28,6 +22,10 @@ import ru.bclib.util.SplineHelper;
|
|||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GiganticAmaranitaFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Function<BlockState, Boolean> IGNORE;
|
||||
|
@ -130,7 +128,8 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (radius < 4) {
|
||||
}
|
||||
else if (radius < 4) {
|
||||
pos = pos.offset(-1, 0, -1);
|
||||
for (int i = -2; i < 2; i++) {
|
||||
mut.set(pos).move(Direction.NORTH, 2).move(Direction.WEST, i);
|
||||
|
@ -201,7 +200,8 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (int i = -2; i < 3; i++) {
|
||||
mut.set(pos).move(Direction.NORTH, 3).move(Direction.EAST, i);
|
||||
if (world.getBlockState(mut).getMaterial().isReplaceable()) {
|
||||
|
@ -316,7 +316,8 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
&& world.getBlockState(mut).getMaterial().isReplaceable()) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.AMARANITA_CAP);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ((x == 0 || z == 0) && (Math.abs(x) < 2 && Math.abs(z) < 2)
|
||||
&& world.getBlockState(mut).getMaterial().isReplaceable()) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.AMARANITA_CAP);
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
@ -31,6 +24,11 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.blocks.HelixTreeLeavesBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class HelixTreeFeature extends DefaultFeature {
|
||||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
|
@ -126,7 +124,8 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
if (ax > az) {
|
||||
start.set(start.x(), start.y(), start.z() + az > 0 ? 1 : -1);
|
||||
end.set(end.x(), end.y(), end.z() + az > 0 ? 1 : -1);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
start.set(start.x() + ax > 0 ? 1 : -1, start.y(), start.z());
|
||||
end.set(end.x() + ax > 0 ? 1 : -1, end.y(), end.z());
|
||||
}
|
||||
|
@ -153,7 +152,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
private void fillLine(Vector3f start, Vector3f end, WorldGenLevel world, BlockState state, BlockPos pos,
|
||||
int offset) {
|
||||
int offset) {
|
||||
float dx = end.x() - start.x();
|
||||
float dy = end.y() - start.y();
|
||||
float dz = end.z() - start.z();
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -29,6 +23,10 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.blocks.JellyshroomCapBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class JellyshroomFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final List<Vector3f> ROOT;
|
||||
|
@ -67,7 +65,8 @@ public class JellyshroomFeature extends DefaultFeature {
|
|||
&& EndBlocks.JELLYSHROOM.isTreeLog(info.getStateDown())) {
|
||||
return EndBlocks.JELLYSHROOM.log.defaultBlockState();
|
||||
}
|
||||
} else if (info.getState().is(EndBlocks.JELLYSHROOM_CAP_PURPLE)) {
|
||||
}
|
||||
else if (info.getState().is(EndBlocks.JELLYSHROOM_CAP_PURPLE)) {
|
||||
float dx = info.getPos().getX() - pos.getX() - last.x();
|
||||
float dz = info.getPos().getZ() - pos.getZ() - last.z();
|
||||
float distance = MHelper.length(dx, dz) / membraneRadius * 7F;
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
@ -30,6 +24,10 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class LacugroveFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Function<BlockState, Boolean> IGNORE;
|
||||
|
@ -99,7 +97,8 @@ public class LacugroveFeature extends DefaultFeature {
|
|||
|| state.is(TagAPI.END_GROUND)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut,
|
||||
y == top ? EndBlocks.LACUGROVE.bark : EndBlocks.LACUGROVE.log);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,11 @@ import ru.bclib.api.TagAPI;
|
|||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -68,7 +72,7 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
private void leavesBall(WorldGenLevel world, BlockPos pos, float radius, Random random, OpenSimplexNoise noise,
|
||||
boolean natural) {
|
||||
boolean natural) {
|
||||
SDF sphere = new SDFSphere().setRadius(radius)
|
||||
.setBlock(EndBlocks.LUCERNIA_LEAVES.defaultBlockState().setValue(LeavesBlock.DISTANCE, 6));
|
||||
SDF sub = new SDFScale().setScale(5).setSource(sphere);
|
||||
|
@ -160,7 +164,8 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
mut.setY(mut.getY() - 1);
|
||||
if (world.isEmptyBlock(mut.below())) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, middle);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,15 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.operator.SDFBinary;
|
||||
import ru.bclib.sdf.operator.SDFCoordModify;
|
||||
import ru.bclib.sdf.operator.SDFFlatWave;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.sdf.primitive.SDFPrimitive;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
|
|
|
@ -65,7 +65,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
private void branch(float x, float y, float z, float size, float angle, Random random, int depth,
|
||||
WorldGenLevel world, BlockPos pos) {
|
||||
WorldGenLevel world, BlockPos pos) {
|
||||
if (depth == 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -15,7 +15,11 @@ import ru.bclib.api.TagAPI;
|
|||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -156,7 +160,8 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
mut.setY(mut.getY() - 1);
|
||||
if (world.isEmptyBlock(mut.below())) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, middle);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,13 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.operator.SDFFlatWave;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -106,7 +112,8 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
if (EndBlocks.UMBRELLA_TREE.isTreeLog(info.getStateUp())
|
||||
&& EndBlocks.UMBRELLA_TREE.isTreeLog(info.getStateDown())) {
|
||||
return EndBlocks.UMBRELLA_TREE.log.defaultBlockState();
|
||||
} else if (info.getState().equals(membrane)) {
|
||||
}
|
||||
else if (info.getState().equals(membrane)) {
|
||||
Center min = centers.get(0);
|
||||
double d = Double.MAX_VALUE;
|
||||
BlockPos bpos = info.getPos();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue