New sounds, registry rename

This commit is contained in:
paulevsGitch 2020-10-27 03:16:55 +03:00
parent c609f98ec2
commit 1c03ecb5e3
105 changed files with 1449 additions and 1447 deletions

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -20,16 +20,16 @@ public class BlueVineFeature extends ScatterFeature {
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F + random.nextFloat() * 0.4F;
small = d > 0.5F;
return BlockRegistry.BLUE_VINE_SEED.canPlaceAt(AIR, world, blockPos);
return EndBlocks.BLUE_VINE_SEED.canPlaceAt(AIR, world, blockPos);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
if (small) {
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.BLUE_VINE_SEED.getDefaultState().with(BlockPlantWithAge.AGE, random.nextInt(4)));
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.BLUE_VINE_SEED.getDefaultState().with(BlockPlantWithAge.AGE, random.nextInt(4)));
}
else {
BlockPlantWithAge seed = ((BlockPlantWithAge) BlockRegistry.BLUE_VINE_SEED);
BlockPlantWithAge seed = ((BlockPlantWithAge) EndBlocks.BLUE_VINE_SEED);
seed.grow(world, random, blockPos);
}
}

View file

@ -8,7 +8,7 @@ import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -27,21 +27,21 @@ public class CaveBushFeature extends FullHeightScatterFeature {
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return world.getBlockState(blockPos.down()).isOf(BlockRegistry.CAVE_MOSS);
return world.getBlockState(blockPos.down()).isOf(EndBlocks.CAVE_MOSS);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
float radius = MHelper.randRange(0.8F, 2.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.CAVE_BUSH);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.CAVE_BUSH);
sphere = new SDFScale3D().setScale(MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random)).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, blockPos);
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.CAVE_BUSH);
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.CAVE_BUSH);
}
static {

View file

@ -8,8 +8,8 @@ import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -29,22 +29,22 @@ public class CaveBushFeatureCeil extends InvertedScatterFeature {
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return world.isAir(blockPos.down())
&& world.getBlockState(blockPos.up()).isIn(BlockTagRegistry.GEN_TERRAIN)
&& world.getBlockState(blockPos.down(BlocksHelper.downRay(world, blockPos.down(), 64) + 2)).isIn(BlockTagRegistry.GEN_TERRAIN);
&& world.getBlockState(blockPos.up()).isIn(EndTags.GEN_TERRAIN)
&& world.getBlockState(blockPos.down(BlocksHelper.downRay(world, blockPos.down(), 64) + 2)).isIn(EndTags.GEN_TERRAIN);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
float radius = MHelper.randRange(1.0F, 3.2F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.CAVE_BUSH);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.CAVE_BUSH);
sphere = new SDFScale3D().setScale(MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random)).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, blockPos.down());
BlocksHelper.setWithoutUpdate(world, blockPos.down(), BlockRegistry.CAVE_BUSH);
BlocksHelper.setWithoutUpdate(world, blockPos.down(), EndBlocks.CAVE_BUSH);
}
static {

View file

@ -10,7 +10,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature;
import ru.betterend.blocks.EndPortalBlock;
import ru.betterend.blocks.RunedFlavolite;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class DefaultEndPortalFeature extends Feature<EndPortalFeatureConfig> {
@ -24,7 +24,7 @@ public class DefaultEndPortalFeature extends Feature<EndPortalFeatureConfig> {
EndPortalFeatureConfig config) {
BlockState portalFrame = config.frameBlock.getDefaultState().with(RunedFlavolite.ACTIVATED, config.activated);
BlockState portalBlock = BlockRegistry.END_PORTAL_BLOCK.getDefaultState().with(EndPortalBlock.AXIS, config.axis);
BlockState portalBlock = EndBlocks.END_PORTAL_BLOCK.getDefaultState().with(EndPortalBlock.AXIS, config.axis);
BlockPos bottomCorner = pos;
BlockPos topCorner;
int width = config.width - 1;

View file

@ -12,8 +12,8 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -108,18 +108,18 @@ public class EndLakeFeature extends DefaultFeature {
r *= r;
if (x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (state.isIn(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
}
pos = POS.down();
if (world.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (world.getBlockState(pos).isIn(EndTags.GEN_TERRAIN)) {
state = world.getBiome(pos).getGenerationSettings().getSurfaceConfig().getTopMaterial();
if (y > waterLevel + 1)
BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state : BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.getDefaultState());
else
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.getDefaultState());
}
}
}
@ -163,8 +163,8 @@ public class EndLakeFeature extends DefaultFeature {
}*/
}
pos = POS.down();
if (world.getBlockState(pos).getBlock().isIn(BlockTagRegistry.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS.down(), BlockRegistry.ENDSTONE_DUST.getDefaultState());
if (world.getBlockState(pos).getBlock().isIn(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS.down(), EndBlocks.ENDSTONE_DUST.getDefaultState());
}
pos = POS.up();
while (canReplace(state = world.getBlockState(pos)) && !state.isAir() && state.getFluidState().isEmpty()) {
@ -180,11 +180,11 @@ public class EndLakeFeature extends DefaultFeature {
//if (world.getBlockState(POS).getMaterial().isReplaceable()) {
if (world.isAir(POS.up())) {
state = world.getBiome(POS).getGenerationSettings().getSurfaceConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
}
else {
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
}
//}
@ -216,8 +216,8 @@ public class EndLakeFeature extends DefaultFeature {
private boolean canReplace(BlockState state) {
return state.getMaterial().isReplaceable()
|| state.isIn(BlockTagRegistry.GEN_TERRAIN)
|| state.isOf(BlockRegistry.ENDSTONE_DUST)
|| state.isIn(EndTags.GEN_TERRAIN)
|| state.isOf(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.UNDERWATER_PLANT)
|| state.getMaterial().equals(Material.UNUSED_PLANT);

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockEndLilySeed;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class EndLilyFeature extends UnderwaterPlantScatter {
public EndLilyFeature(int radius) {
@ -14,7 +14,7 @@ public class EndLilyFeature extends UnderwaterPlantScatter {
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlockEndLilySeed seed = (BlockEndLilySeed) BlockRegistry.END_LILY_SEED;
BlockEndLilySeed seed = (BlockEndLilySeed) EndBlocks.END_LILY_SEED;
seed.grow(world, random, blockPos);
}

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockEndLotusSeed;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class EndLotusFeature extends UnderwaterPlantScatter {
public EndLotusFeature(int radius) {
@ -14,7 +14,7 @@ public class EndLotusFeature extends UnderwaterPlantScatter {
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlockEndLotusSeed seed = (BlockEndLotusSeed) BlockRegistry.END_LOTUS_SEED;
BlockEndLotusSeed seed = (BlockEndLotusSeed) EndBlocks.END_LOTUS_SEED;
seed.grow(world, random, blockPos);
}

View file

@ -10,7 +10,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockEndLotusLeaf;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class EndLotusLeafFeature extends ScatterFeature {
@ -37,7 +37,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
private void generateLeaf(StructureWorldAccess world, BlockPos pos) {
Mutable p = new Mutable();
BlockState leaf = BlockRegistry.END_LOTUS_LEAF.getDefaultState();
BlockState leaf = EndBlocks.END_LOTUS_LEAF.getDefaultState();
BlocksHelper.setWithoutUpdate(world, pos, leaf.with(BlockEndLotusLeaf.SHAPE, TripleShape.BOTTOM));
for (Direction move: BlocksHelper.HORIZONTAL) {
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.with(BlockEndLotusLeaf.HORIZONTAL_FACING, move).with(BlockEndLotusLeaf.SHAPE, TripleShape.MIDDLE));

View file

@ -17,8 +17,8 @@ import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper;
@ -56,21 +56,21 @@ public class MossyGlowshroomFeature extends DefaultFeature {
if (blockPos.getY() < 5) {
return false;
}
if (!world.getBlockState(blockPos.down()).isIn(BlockTagRegistry.END_GROUND)) {
if (!world.getBlockState(blockPos.down()).isIn(EndTags.END_GROUND)) {
return false;
}
CONE1.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_CAP);
CONE2.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_CAP);
CONE_GLOW.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE);
ROOTS.setBlock(BlockRegistry.MOSSY_GLOWSHROOM.bark);
CONE1.setBlock(EndBlocks.MOSSY_GLOWSHROOM_CAP);
CONE2.setBlock(EndBlocks.MOSSY_GLOWSHROOM_CAP);
CONE_GLOW.setBlock(EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE);
ROOTS.setBlock(EndBlocks.MOSSY_GLOWSHROOM.bark);
float height = MHelper.randRange(10F, 25F, random);
int count = MHelper.floor(height / 4);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, count);
SplineHelper.offsetParts(spline, random, 1F, 0, 1F);
SDF sdf = SplineHelper.buildSDF(spline, 2.1F, 1.5F, (pos) -> {
return BlockRegistry.MOSSY_GLOWSHROOM.log.getDefaultState();
return EndBlocks.MOSSY_GLOWSHROOM.log.getDefaultState();
});
Vector3f pos = spline.get(spline.size() - 1);
float scale = MHelper.randRange(0.75F, 1.1F, random);
@ -113,34 +113,34 @@ public class MossyGlowshroomFeature extends DefaultFeature {
.setSource(FUNCTION)
.setReplaceFunction(REPLACE)
.setPostProcess((info) -> {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
if (random.nextBoolean() && info.getStateUp().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_CAP) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
if (random.nextBoolean() && info.getStateUp().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
return info.getState();
}
else if (!BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM.bark.getDefaultState());
else if (!EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM.bark.getDefaultState());
return info.getState();
}
}
else if (info.getState().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_CAP) {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) {
if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
return info.getState();
}
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState());
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState());
return info.getState();
}
else if (info.getState().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE) {
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
for (Direction dir: BlocksHelper.HORIZONTAL) {
if (info.getState(dir) == AIR) {
info.setBlockPos(info.getPos().offset(dir), BlockRegistry.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
}
}
if (info.getStateDown().getBlock() != BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), BlockRegistry.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN));
if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN));
}
}
return info.getState();
@ -190,7 +190,7 @@ public class MossyGlowshroomFeature extends DefaultFeature {
FUNCTION = new SDFSmoothUnion().setRadius(4).setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS_ROT));
REPLACE = (state) -> {
if (state.isIn(BlockTagRegistry.END_GROUND)) {
if (state.isIn(EndTags.END_GROUND)) {
return true;
}
if (state.getMaterial().equals(Material.PLANT)) {

View file

@ -11,7 +11,7 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -26,18 +26,18 @@ public class PythadendronBushFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (world.getBlockState(pos.down()).getBlock() != BlockRegistry.CHORUS_NYLIUM) return false;
if (world.getBlockState(pos.down()).getBlock() != EndBlocks.CHORUS_NYLIUM) return false;
float radius = MHelper.randRange(1.8F, 4.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.PYTHADENDRON.bark);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.PYTHADENDRON.bark);
return true;
}

View file

@ -13,8 +13,8 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper;
@ -30,7 +30,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (world.getBlockState(pos.down()).getBlock() != BlockRegistry.CHORUS_NYLIUM) return false;
if (world.getBlockState(pos.down()).getBlock() != EndBlocks.CHORUS_NYLIUM) return false;
float size = MHelper.randRange(10, 20, random);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 4);
@ -42,11 +42,11 @@ public class PythadendronTreeFeature extends DefaultFeature {
branch(last.getX(), last.getY(), last.getZ(), size * bsize, MHelper.randRange(0, MHelper.PI2, random), random, depth, world, pos);
SDF function = SplineHelper.buildSDF(spline, 1.7F, 1.1F, (bpos) -> {
return BlockRegistry.PYTHADENDRON.bark.getDefaultState();
return EndBlocks.PYTHADENDRON.bark.getDefaultState();
});
function.setPostProcess((info) -> {
if (BlockRegistry.PYTHADENDRON.isTreeLog(info.getStateUp()) && BlockRegistry.PYTHADENDRON.isTreeLog(info.getStateDown())) {
return BlockRegistry.PYTHADENDRON.log.getDefaultState();
if (EndBlocks.PYTHADENDRON.isTreeLog(info.getStateUp()) && EndBlocks.PYTHADENDRON.isTreeLog(info.getStateDown())) {
return EndBlocks.PYTHADENDRON.log.getDefaultState();
}
return info.getState();
});
@ -73,14 +73,14 @@ public class PythadendronTreeFeature extends DefaultFeature {
SplineHelper.offsetParts(spline, random, 0.3F, 0, 0.3F);
Vector3f pos1 = spline.get(spline.size() - 1);
boolean s1 = SplineHelper.fillSpline(spline, world, BlockRegistry.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
boolean s1 = SplineHelper.fillSpline(spline, world, EndBlocks.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
spline = SplineHelper.makeSpline(x, y, z, x2, y, z2, 5);
SplineHelper.powerOffset(spline, size * MHelper.randRange(1.0F, 2.0F, random), 4);
SplineHelper.offsetParts(spline, random, 0.3F, 0, 0.3F);
Vector3f pos2 = spline.get(spline.size() - 1);
boolean s2 = SplineHelper.fillSpline(spline, world, BlockRegistry.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
boolean s2 = SplineHelper.fillSpline(spline, world, EndBlocks.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
if (depth < 3) {
@ -138,7 +138,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
private void leavesBall(StructureWorldAccess world, BlockPos pos, Random random, OpenSimplexNoise noise) {
float radius = MHelper.randRange(4.5F, 6.5F, random);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
sphere = new SDFScale3D().setScale(1, 0.6F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
@ -150,17 +150,17 @@ public class PythadendronTreeFeature extends DefaultFeature {
int count = (int) (radius * 2.5F);
for (int i = 0; i < count; i++) {
BlockPos p = pos.add(random.nextGaussian() * 1.5, random.nextGaussian() * 1.5, random.nextGaussian() * 1.5);
BlocksHelper.setWithoutUpdate(world, p, BlockRegistry.PYTHADENDRON.bark);
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.PYTHADENDRON.bark);
}
}
}
static {
REPLACE = (state) -> {
if (state.isIn(BlockTagRegistry.END_GROUND)) {
if (state.isIn(EndTags.END_GROUND)) {
return true;
}
if (state.getBlock() == BlockRegistry.PYTHADENDRON_LEAVES) {
if (state.getBlock() == EndBlocks.PYTHADENDRON_LEAVES) {
return true;
}
if (state.getMaterial().equals(Material.PLANT)) {

View file

@ -16,9 +16,9 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -45,7 +45,7 @@ public class RoundCaveFeature extends DefaultFeature {
bpos.setX(pos.getX());
bpos.setZ(pos.getZ());
bpos.setY(top);
while (top > bottom && !world.getBlockState(bpos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
while (top > bottom && !world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
bpos.setY(--top);
}
top -= radius + 5;
@ -69,7 +69,7 @@ public class RoundCaveFeature extends DefaultFeature {
double nr = radius * 0.25;
Set<BlockPos> bushes = Sets.newHashSet();
BlockState terrain = BlockRegistry.CAVE_MOSS.getDefaultState();
BlockState terrain = EndBlocks.CAVE_MOSS.getDefaultState();
for (int x = x1; x <= x2; x++) {
int xsq = x - pos.getX();
xsq *= xsq;
@ -105,7 +105,7 @@ public class RoundCaveFeature extends DefaultFeature {
}
}
bpos.setY(y - 1);
if (world.getBlockState(bpos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, bpos, terrain);
}
}
@ -114,16 +114,16 @@ public class RoundCaveFeature extends DefaultFeature {
if (!state.getFluidState().isEmpty()) {
BlocksHelper.setWithoutUpdate(world, bpos, Blocks.END_STONE.getDefaultState());
}
else if (world.getBlockState(bpos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
else if (world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
if (world.isAir(bpos.down())) {
int h = BlocksHelper.downRay(world, bpos.down(), 64);
if (h > 6 && h < 32 && world.getBlockState(bpos.down(h + 3)).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (h > 6 && h < 32 && world.getBlockState(bpos.down(h + 3)).isIn(EndTags.GEN_TERRAIN)) {
bushes.add(bpos.down());
}
}
else if (world.isAir(bpos.up())) {
int h = BlocksHelper.upRay(world, bpos.up(), 64);
if (h > 6 && h < 32 && world.getBlockState(bpos.up(h + 3)).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (h > 6 && h < 32 && world.getBlockState(bpos.up(h + 3)).isIn(EndTags.GEN_TERRAIN)) {
bushes.add(bpos.up());
}
}
@ -138,23 +138,23 @@ public class RoundCaveFeature extends DefaultFeature {
}
});
if (random.nextBoolean() && world.getBiome(pos).getGenerationSettings().hasStructureFeature(StructureRegistry.MOUNTAIN.getStructure())) {
if (random.nextBoolean() && world.getBiome(pos).getGenerationSettings().hasStructureFeature(EndStructures.MOUNTAIN.getStructure())) {
pos = pos.add(random.nextGaussian() * 5, random.nextGaussian() * 5, random.nextGaussian() * 5);
BlockPos down = pos.down(BlocksHelper.downRay(world, pos, 64) + 2);
if (isReplaceable(world.getBlockState(down))) {
SDF prism = new SDFHexPrism().setHeight(radius * MHelper.randRange(0.6F, 0.75F, random)).setRadius(MHelper.randRange(1.7F, 3F, random)).setBlock(BlockRegistry.AURORA_CRYSTAL);
SDF prism = new SDFHexPrism().setHeight(radius * MHelper.randRange(0.6F, 0.75F, random)).setRadius(MHelper.randRange(1.7F, 3F, random)).setBlock(EndBlocks.AURORA_CRYSTAL);
float angleY = MHelper.randRange(0, MHelper.PI2, random);
float vx = (float) Math.sin(angleY);
float vz = (float) Math.sin(angleY);
prism = new SDFRotation().setRotation(new Vector3f(vx, 0, vz), random.nextFloat()).setSource(prism);
prism.setReplaceFunction((state) -> {
return state.getMaterial().isReplaceable()
|| state.isIn(BlockTagRegistry.GEN_TERRAIN)
|| state.isIn(EndTags.GEN_TERRAIN)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.LEAVES);
});
prism.fillRecursive(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.AURORA_CRYSTAL);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.AURORA_CRYSTAL);
}
}
@ -164,7 +164,7 @@ public class RoundCaveFeature extends DefaultFeature {
}
private boolean isReplaceable(BlockState state) {
return state.isIn(BlockTagRegistry.GEN_TERRAIN)
return state.isIn(EndTags.GEN_TERRAIN)
|| state.getMaterial().isReplaceable()
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.LEAVES);
@ -173,12 +173,12 @@ public class RoundCaveFeature extends DefaultFeature {
private void generateBush(StructureWorldAccess world, Random random, BlockPos blockPos) {
float radius = MHelper.randRange(1.0F, 3.2F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.CAVE_BUSH);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.CAVE_BUSH);
sphere = new SDFScale3D().setScale(MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random)).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.fillRecursive(world, blockPos);
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.CAVE_BUSH);
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.CAVE_BUSH);
}
}

View file

@ -7,7 +7,7 @@ import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -31,7 +31,7 @@ public abstract class ScatterFeature extends DefaultFeature {
if (pos.getY() < 5) {
return false;
}
else if (!world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
else if (!world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) {
return false;
}
return true;