Fleshy things
This commit is contained in:
parent
6a95b28bc6
commit
b3931fc24b
5 changed files with 84 additions and 56 deletions
|
@ -37,6 +37,7 @@ public class VisceralHeapBiome extends NetherBiomeBOP
|
|||
this.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Feature.GLOWSTONE_BLOB.configured(IFeatureConfig.NONE).decorated(Placement.LIGHT_GEM_CHANCE.configured(new FrequencyConfig(7))));
|
||||
this.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Feature.GLOWSTONE_BLOB.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_RANGE.configured(new CountRangeConfig(7, 0, 0, 128))));
|
||||
|
||||
this.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPBiomeFeatures.FLESH_TENDON.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(20))));
|
||||
this.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPBiomeFeatures.BONE_SPINE.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(10))));
|
||||
this.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, BOPBiomeFeatures.SHROOMLIGHT_SCATTER.configured(IFeatureConfig.NONE).decorated(Placement.COUNT_HEIGHTMAP_DOUBLE.configured(new FrequencyConfig(5))));
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ public class BOPBiomeFeatures
|
|||
public static final Feature<NoFeatureConfig> SHROOMLIGHT_SCATTER = new ShroomlightFeature(NoFeatureConfig.CODEC);
|
||||
public static final Feature<NoFeatureConfig> SMALL_CRYSTAL = new SmallCrystalFeature(NoFeatureConfig.CODEC);
|
||||
public static final Feature<NoFeatureConfig> LARGE_CRYSTAL = new LargeCrystalFeature(NoFeatureConfig.CODEC);
|
||||
public static final Feature<NoFeatureConfig> FLESH_TENDON = new FleshTendonFeature(NoFeatureConfig.CODEC);
|
||||
|
||||
//Flowers
|
||||
public static final FlowersFeature CHAPARRAL_FLOWERS = new ChaparralFlowersFeature();
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package biomesoplenty.common.world.gen.feature;
|
||||
|
||||
import biomesoplenty.api.block.BOPBlocks;
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ISeedReader;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.structure.StructureManager;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FleshSplatterFeature extends Feature<NoFeatureConfig>
|
||||
{
|
||||
public FleshSplatterFeature(Codec<NoFeatureConfig> deserializer)
|
||||
{
|
||||
super(deserializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean place(ISeedReader worldIn, StructureManager structureManager, ChunkGenerator chunkGenerator, Random rand, BlockPos pos, NoFeatureConfig config)
|
||||
{
|
||||
int i = 0;
|
||||
int j = rand.nextInt(8 - 2) + 2;
|
||||
|
||||
for (int k = pos.getX() - j; k <= pos.getX() + j; ++k)
|
||||
{
|
||||
for (int l = pos.getZ() - j; l <= pos.getZ() + j; ++l)
|
||||
{
|
||||
int i1 = k - pos.getX();
|
||||
int j1 = l - pos.getZ();
|
||||
if (i1 * i1 + j1 * j1 <= j * j)
|
||||
{
|
||||
for (int k1 = pos.getY() - 2; k1 <= pos.getY() + 2; ++k1)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(k, k1, l);
|
||||
BlockState blockstate = worldIn.getBlockState(blockpos);
|
||||
BlockState blockstate1 = worldIn.getBlockState(blockpos.above());
|
||||
|
||||
if (blockstate.getBlock() == Blocks.NETHERRACK && blockstate1.isAir(worldIn, blockpos.above()))
|
||||
{
|
||||
worldIn.setBlock(blockpos, BOPBlocks.flesh.defaultBlockState(), 2);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package biomesoplenty.common.world.gen.feature;
|
||||
|
||||
import biomesoplenty.api.block.BOPBlocks;
|
||||
import biomesoplenty.common.block.NetherCrystalBlock;
|
||||
import biomesoplenty.common.util.block.IBlockPosQuery;
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.state.properties.AttachFace;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.ISeedReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.structure.StructureManager;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FleshTendonFeature extends Feature<NoFeatureConfig>
|
||||
{
|
||||
protected IBlockPosQuery placeOn = (world, pos) -> world.getBlockState(pos).getBlock() == BOPBlocks.flesh;
|
||||
protected IBlockPosQuery replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos) || world.getBlockState(pos).getBlock() == BOPBlocks.nether_crystal;
|
||||
|
||||
public FleshTendonFeature(Codec<NoFeatureConfig> deserializer)
|
||||
{
|
||||
super(deserializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean place(ISeedReader world, StructureManager p_230362_2_, ChunkGenerator p_230362_3_, Random rand, BlockPos pos, NoFeatureConfig p_230362_6_)
|
||||
{
|
||||
if (!world.isEmptyBlock(pos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockState blockstate = world.getBlockState(pos.below());
|
||||
if (!blockstate.is(BOPBlocks.flesh))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int height = 120;
|
||||
double baseSlant = rand.nextInt(35) / 100D;
|
||||
double slantOffset = baseSlant;
|
||||
double slantMultiplier = 1.3D;
|
||||
Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(rand);
|
||||
|
||||
for(int step = 0; step <= height; step++)
|
||||
{
|
||||
BlockPos offsetPos = pos.above(step).relative(direction, (int)Math.floor(slantOffset));
|
||||
|
||||
if (offsetPos.getY() < 127)
|
||||
{
|
||||
this.setBlock(world, offsetPos, BOPBlocks.flesh.defaultBlockState());
|
||||
}
|
||||
|
||||
//As the height increases, slant more drastically
|
||||
slantOffset *= slantMultiplier;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setBlock(IWorld world, BlockPos pos, BlockState state)
|
||||
{
|
||||
if (this.replace.matches(world, pos))
|
||||
{
|
||||
super.setBlock(world, pos, state);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -138,6 +138,7 @@ public class ModFeatures
|
|||
registerFeatures(BOPBiomeFeatures.SHROOMLIGHT_SCATTER, "shroomlight_scatter");
|
||||
registerFeatures(BOPBiomeFeatures.SMALL_CRYSTAL, "small_crystal");
|
||||
registerFeatures(BOPBiomeFeatures.LARGE_CRYSTAL, "large_crystal");
|
||||
registerFeatures(BOPBiomeFeatures.FLESH_TENDON, "flesh_tendon");
|
||||
|
||||
//Flowers
|
||||
registerFeatures(BOPBiomeFeatures.CHAPARRAL_FLOWERS, "chaparral_flowers");
|
||||
|
|
Loading…
Reference in a new issue