Tag switching (WIP)

This commit is contained in:
paulevsGitch 2021-05-26 17:13:36 +03:00
parent 0486d7d89c
commit 41df84404b
72 changed files with 303 additions and 628 deletions

View file

@ -9,12 +9,12 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFRotation;
import ru.bclib.sdf.primitive.SDFHexPrism;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -38,7 +38,7 @@ public class BigAuroraCrystalFeature extends DefaultFeature {
Vector3f vec = MHelper.randomHorizontal(random);
prism = new SDFRotation().setRotation(vec, random.nextFloat()).setSource(prism);
prism.setReplaceFunction((bState) -> {
return bState.getMaterial().isReplaceable() || bState.is(EndTags.GEN_TERRAIN)
return bState.getMaterial().isReplaceable() || bState.is(TagAPI.GEN_TERRAIN)
|| bState.getMaterial().equals(Material.PLANT) || bState.getMaterial().equals(Material.LEAVES);
});
prism.fillRecursive(world, pos);

View file

@ -11,10 +11,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -110,11 +110,11 @@ public class DesertLakeFeature extends DefaultFeature {
r *= r;
if (x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.is(EndTags.GEN_TERRAIN)) {
if (state.is(TagAPI.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
}
pos = POS.below();
if (world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(pos).is(TagAPI.GEN_TERRAIN)) {
state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1)
BlocksHelper.setWithoutUpdate(world, pos, state);
@ -162,7 +162,7 @@ public class DesertLakeFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, POS, state);
}
pos = POS.below();
if (world.getBlockState(pos).getBlock().is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(pos).getBlock().is(TagAPI.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
}
pos = POS.above();
@ -174,7 +174,7 @@ public class DesertLakeFeature extends DefaultFeature {
// Make border
else if (y2 + x2 + z2 <= rb) {
state = world.getBlockState(POS);
if (state.is(EndTags.GEN_TERRAIN) && world.isEmptyBlock(POS.above())) {
if (state.is(TagAPI.GEN_TERRAIN) && world.isEmptyBlock(POS.above())) {
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.END_MOSS);
}
else if (y < waterLevel) {
@ -201,7 +201,7 @@ public class DesertLakeFeature extends DefaultFeature {
private boolean canReplace(BlockState state) {
return state.getMaterial().isReplaceable()
|| state.is(EndTags.GEN_TERRAIN)
|| state.is(TagAPI.GEN_TERRAIN)
|| state.is(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.WATER_PLANT)

View file

@ -11,10 +11,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -110,11 +110,11 @@ public class EndLakeFeature extends DefaultFeature {
r *= r;
if (x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.is(EndTags.GEN_TERRAIN)) {
if (state.is(TagAPI.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
}
pos = POS.below();
if (world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(pos).is(TagAPI.GEN_TERRAIN)) {
state = world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1)
BlocksHelper.setWithoutUpdate(world, pos, state);
@ -162,7 +162,7 @@ public class EndLakeFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, POS, state);
}
pos = POS.below();
if (world.getBlockState(pos).getBlock().is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(pos).getBlock().is(TagAPI.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.defaultBlockState());
}
pos = POS.above();
@ -195,7 +195,7 @@ public class EndLakeFeature extends DefaultFeature {
private boolean canReplace(BlockState state) {
return state.getMaterial().isReplaceable()
|| state.is(EndTags.GEN_TERRAIN)
|| state.is(TagAPI.GEN_TERRAIN)
|| state.is(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.WATER_PLANT)

View file

@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFRotation;
@ -19,16 +20,14 @@ import ru.bclib.sdf.primitive.SDFCappedCone;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.world.features.DefaultFeature;
public class FallenPillarFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
pos = getPosOnSurface(world,
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
if (!world.getBlockState(pos.below(5)).is(EndTags.GEN_TERRAIN)) {
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
return false;
}
@ -52,7 +51,7 @@ public class FallenPillarFeature extends DefaultFeature {
}
return info.getState();
}).setReplaceFunction((state) -> {
return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN)
return state.getMaterial().isReplaceable() || state.is(TagAPI.GEN_TERRAIN)
|| state.getMaterial().equals(Material.PLANT);
}).fillRecursive(world, pos);

View file

@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFCoordModify;
import ru.bclib.sdf.operator.SDFDisplacement;
@ -35,7 +36,6 @@ import ru.betterend.blocks.HydrothermalVentBlock;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -57,7 +57,7 @@ public class GeyserFeature extends DefaultFeature {
MutableBlockPos bpos = new MutableBlockPos().set(pos);
bpos.setY(bpos.getY() - 1);
BlockState state = world.getBlockState(bpos);
while (state.is(EndTags.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) {
while (state.is(TagAPI.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) {
bpos.setY(bpos.getY() - 1);
state = world.getBlockState(bpos);
}
@ -182,7 +182,7 @@ public class GeyserFeature extends DefaultFeature {
mut.setY(mut.getY() - 1);
state = world.getBlockState(mut);
}
if (state.is(EndTags.GEN_TERRAIN)
if (state.is(TagAPI.GEN_TERRAIN)
&& !world.getBlockState(mut.above()).is(EndBlocks.HYDROTHERMAL_VENT)) {
for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
@ -221,7 +221,7 @@ public class GeyserFeature extends DefaultFeature {
mut.setY(mut.getY() - 1);
state = world.getBlockState(mut);
}
if (state.is(EndTags.GEN_TERRAIN)) {
if (state.is(TagAPI.GEN_TERRAIN)) {
for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
mut.setY(mut.getY() + 1);
@ -252,12 +252,11 @@ public class GeyserFeature extends DefaultFeature {
static {
REPLACE1 = (state) -> {
return state.isAir() || (state.is(EndTags.GEN_TERRAIN));
return state.isAir() || (state.is(TagAPI.GEN_TERRAIN));
};
REPLACE2 = (state) -> {
if (state.is(EndTags.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT)
|| state.is(EndBlocks.SULPHUR_CRYSTAL)) {
if (state.is(TagAPI.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT) || state.is(EndBlocks.SULPHUR_CRYSTAL)) {
return true;
}
if (state.getMaterial().equals(Material.PLANT)) {
@ -267,8 +266,7 @@ public class GeyserFeature extends DefaultFeature {
};
IGNORE = (state) -> {
return state.is(Blocks.WATER) || state.is(Blocks.CAVE_AIR) || state.is(EndBlocks.SULPHURIC_ROCK.stone)
|| state.is(EndBlocks.BRIMSTONE);
return state.is(Blocks.WATER) || state.is(Blocks.CAVE_AIR) || state.is(EndBlocks.SULPHURIC_ROCK.stone) || state.is(EndBlocks.BRIMSTONE);
};
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFScale3D;
@ -16,7 +17,6 @@ import ru.bclib.sdf.primitive.SDFSphere;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.world.features.DefaultFeature;
public class ObsidianBoulderFeature extends DefaultFeature {
@ -25,7 +25,7 @@ public class ObsidianBoulderFeature extends DefaultFeature {
NoneFeatureConfiguration config) {
pos = getPosOnSurface(world,
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
if (!world.getBlockState(pos.below()).is(EndTags.END_GROUND)) {
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
return false;
}
@ -40,7 +40,7 @@ public class ObsidianBoulderFeature extends DefaultFeature {
}
private void makeBoulder(WorldGenLevel world, BlockPos pos, Random random) {
if (!world.getBlockState(pos.below()).is(EndTags.END_GROUND)) {
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
return;
}
@ -62,7 +62,7 @@ public class ObsidianBoulderFeature extends DefaultFeature {
}
return info.getState();
}).setReplaceFunction((state) -> {
return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN)
return state.getMaterial().isReplaceable() || state.is(TagAPI.GEN_TERRAIN)
|| state.getMaterial().equals(Material.PLANT);
}).fillRecursive(world, pos);
}

View file

@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFRotation;
@ -21,14 +22,13 @@ import ru.bclib.sdf.primitive.SDFFlatland;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.world.features.DefaultFeature;
public class ObsidianPillarBasementFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
if (!world.getBlockState(pos.below(5)).is(EndTags.GEN_TERRAIN)) {
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
return false;
}
@ -56,7 +56,7 @@ public class ObsidianPillarBasementFeature extends DefaultFeature {
}
return info.getState();
}).setReplaceFunction((state) -> {
return state.getMaterial().isReplaceable() || state.is(EndTags.GEN_TERRAIN) || state.getMaterial().equals(Material.PLANT);
return state.getMaterial().isReplaceable() || state.is(TagAPI.GEN_TERRAIN) || state.getMaterial().equals(Material.PLANT);
}).fillRecursive(world, pos);
return true;

View file

@ -9,7 +9,7 @@ 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.configurations.NoneFeatureConfiguration;
import ru.betterend.registry.EndTags;
import ru.bclib.api.TagAPI;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -21,9 +21,8 @@ public class SingleBlockFeature extends DefaultFeature {
}
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).is(EndTags.GEN_TERRAIN)) {
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
return false;
}

View file

@ -9,9 +9,9 @@ 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.configurations.NoneFeatureConfiguration;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -19,7 +19,7 @@ public class SmaragdantCrystalFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).is(EndTags.GEN_TERRAIN)) {
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
return false;
}
@ -38,7 +38,7 @@ public class SmaragdantCrystalFeature extends DefaultFeature {
mut.setY(mut.getY() - 1);
state = world.getBlockState(mut);
}
if (state.is(EndTags.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(crystal.getBlock())) {
if (state.is(TagAPI.GEN_TERRAIN) && !world.getBlockState(mut.above()).is(crystal.getBlock())) {
for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, crystal);
mut.setY(mut.getY() + 1);

View file

@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFSmoothUnion;
@ -24,7 +25,6 @@ import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndTags;
import ru.betterend.world.features.DefaultFeature;
public class SpireFeature extends DefaultFeature {
@ -34,8 +34,8 @@ public class SpireFeature extends DefaultFeature {
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
pos = getPosOnSurfaceWG(world, pos);
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(EndTags.GEN_TERRAIN)
|| !world.getBlockState(pos.below(6)).is(EndTags.GEN_TERRAIN)) {
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)
|| !world.getBlockState(pos.below(6)).is(TagAPI.GEN_TERRAIN)) {
return false;
}
@ -83,7 +83,7 @@ public class SpireFeature extends DefaultFeature {
static {
REPLACE = (state) -> {
if (state.is(EndTags.END_GROUND)) {
if (state.is(TagAPI.END_GROUND)) {
return true;
}
if (state.getBlock() instanceof LeavesBlock) {

View file

@ -11,8 +11,8 @@ 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.configurations.NoneFeatureConfiguration;
import ru.bclib.api.TagAPI;
import ru.betterend.blocks.basis.StalactiteBlock;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -43,7 +43,7 @@ public class StalactiteFeature extends DefaultFeature {
mut.setY(pos.getY() + i * dir);
BlockState state = world.getBlockState(mut);
if (!state.getMaterial().isReplaceable()) {
stalagnate = state.is(EndTags.GEN_TERRAIN);
stalagnate = state.is(TagAPI.GEN_TERRAIN);
height = i;
break;
}

View file

@ -16,12 +16,12 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.blocks.SulphurCrystalBlock;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -42,7 +42,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
bpos.setY(top - 1);
BlockState state = world.getBlockState(bpos);
while (!state.is(EndTags.GEN_TERRAIN) && bpos.getY() > 5) {
while (!state.is(TagAPI.GEN_TERRAIN) && bpos.getY() > 5) {
bpos.setY(bpos.getY() - 1);
state = world.getBlockState(bpos);
}
@ -51,7 +51,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
}
top = (int) (bpos.getY() - (radius * 1.3F + 5));
while (state.is(EndTags.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) {
while (state.is(TagAPI.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) {
bpos.setY(bpos.getY() - 1);
state = world.getBlockState(bpos);
}
@ -102,7 +102,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
}
} else if (dist < r2 * r2) {
state = world.getBlockState(mut);
if (state.is(EndTags.GEN_TERRAIN) || state.is(Blocks.AIR)) {
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) {
@ -132,7 +132,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
mut.setY(mut.getY() - 1);
state = world.getBlockState(mut);
}
if (state.is(EndTags.GEN_TERRAIN)
if (state.is(TagAPI.GEN_TERRAIN)
&& !world.getBlockState(mut.above()).is(EndBlocks.HYDROTHERMAL_VENT)) {
for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
@ -167,7 +167,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
}
private boolean isReplaceable(BlockState state) {
return state.is(EndTags.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT)
return state.is(TagAPI.GEN_TERRAIN) || state.is(EndBlocks.HYDROTHERMAL_VENT)
|| state.is(EndBlocks.VENT_BUBBLE_COLUMN) || state.is(EndBlocks.SULPHUR_CRYSTAL)
|| state.getMaterial().isReplaceable() || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.WATER_PLANT) || state.getMaterial().equals(Material.LEAVES);

View file

@ -14,12 +14,12 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Fluids;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.blocks.SulphurCrystalBlock;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -60,7 +60,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
int dist = x2 + z2;
if (dist <= r) {
POS.setY(getYOnSurface(world, x, z) - 1);
if (world.getBlockState(POS).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(POS).is(TagAPI.GEN_TERRAIN)) {
if (isBorder(world, POS)) {
if (random.nextInt(8) > 0) {
brimstone.add(POS.immutable());
@ -93,7 +93,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
brimstone.remove(POS);
for (Direction dir : BlocksHelper.HORIZONTAL) {
BlockPos offseted = POS.relative(dir);
if (world.getBlockState(offseted).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(offseted).is(TagAPI.GEN_TERRAIN)) {
brimstone.add(offseted);
}
}
@ -102,7 +102,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
brimstone.remove(POS);
for (Direction dir : BlocksHelper.HORIZONTAL) {
BlockPos offseted = POS.relative(dir);
if (world.getBlockState(offseted).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(offseted).is(TagAPI.GEN_TERRAIN)) {
brimstone.add(offseted);
}
}
@ -118,7 +118,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
}
} else if (dist < r2) {
POS.setY(getYOnSurface(world, x, z) - 1);
if (world.getBlockState(POS).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(POS).is(TagAPI.GEN_TERRAIN)) {
brimstone.add(POS.immutable());
if (random.nextBoolean()) {
brimstone.add(POS.below());

View file

@ -8,10 +8,10 @@ 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.configurations.NoneFeatureConfiguration;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.HydrothermalVentBlock;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -21,26 +21,23 @@ public class SurfaceVentFeature extends DefaultFeature {
NoneFeatureConfiguration config) {
pos = getPosOnSurface(world,
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
if (!world.getBlockState(pos.below(3)).is(EndTags.GEN_TERRAIN)) {
if (!world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)) {
return false;
}
MutableBlockPos mut = new MutableBlockPos();
int count = MHelper.randRange(15, 30, random);
BlockState vent = EndBlocks.HYDROTHERMAL_VENT.defaultBlockState().setValue(HydrothermalVentBlock.WATERLOGGED,
false);
BlockState vent = EndBlocks.HYDROTHERMAL_VENT.defaultBlockState().setValue(HydrothermalVentBlock.WATERLOGGED, false);
for (int i = 0; i < count; i++) {
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5,
MHelper.floor(random.nextGaussian() * 2 + 0.5));
int dist = MHelper.floor(2 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ()))
+ random.nextInt(2);
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5, MHelper.floor(random.nextGaussian() * 2 + 0.5));
int dist = MHelper.floor(2 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2);
if (dist > 0) {
BlockState state = world.getBlockState(mut);
for (int n = 0; n < 10 && state.isAir(); n++) {
mut.setY(mut.getY() - 1);
state = world.getBlockState(mut);
}
if (state.is(EndTags.GEN_TERRAIN)
if (state.is(TagAPI.GEN_TERRAIN)
&& !world.getBlockState(mut.above()).is(EndBlocks.HYDROTHERMAL_VENT)) {
for (int j = 0; j <= dist; j++) {
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);

View file

@ -15,7 +15,7 @@ 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.configurations.NoneFeatureConfiguration;
import ru.betterend.registry.EndTags;
import ru.bclib.api.TagAPI;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.biome.cave.EndCaveBiome;
import ru.betterend.world.features.DefaultFeature;
@ -28,8 +28,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
}
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
Set<BlockPos> floorPositions = Sets.newHashSet();
Set<BlockPos> ceilPositions = Sets.newHashSet();
int sx = (pos.getX() >> 4) << 4;
@ -61,12 +60,13 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
mut.setY(y);
BlockState top = chunk.getBlockState(mut);
BlockState bottom = chunk.getBlockState(mut2);
if (top.isAir() && (bottom.is(EndTags.GEN_TERRAIN) || bottom.is(Blocks.STONE))) {
if (top.isAir() && (bottom.is(TagAPI.GEN_TERRAIN) || bottom.is(Blocks.STONE))) {
mut3.set(mut2).move(sx, 0, sz);
floorPositions.add(mut3.immutable());
updateMin(mut3, min);
updateMax(mut3, max);
} else if (bottom.isAir() && (top.is(EndTags.GEN_TERRAIN) || top.is(Blocks.STONE))) {
}
else if (bottom.isAir() && (top.is(TagAPI.GEN_TERRAIN) || top.is(Blocks.STONE))) {
mut3.set(mut).move(sx, 0, sz);
ceilPositions.add(mut3.immutable());
updateMin(mut3, min);

View file

@ -19,10 +19,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.interfaces.IBiomeArray;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.biome.EndBiome;
import ru.betterend.world.biome.cave.EndCaveBiome;
@ -63,11 +63,11 @@ public abstract class EndCaveFeature extends DefaultFeature {
mut.set(bpos);
if (world.getBlockState(mut).getMaterial().isReplaceable()) {
mut.setY(bpos.getY() - 1);
if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) {
floorPositions.add(mut.immutable());
}
mut.setY(bpos.getY() + 1);
if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) {
ceilPositions.add(mut.immutable());
}
}
@ -124,7 +124,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
if (wallBlock != null) {
for (Vec3i offset: SPHERE) {
BlockPos wallPos = pos.offset(offset);
if (!positions.contains(wallPos) && !placed.contains(wallPos) && world.getBlockState(wallPos).is(EndTags.GEN_TERRAIN)) {
if (!positions.contains(wallPos) && !placed.contains(wallPos) && world.getBlockState(wallPos).is(TagAPI.GEN_TERRAIN)) {
wallBlock = biome.getWall(wallPos);
BlocksHelper.setWithoutUpdate(world, wallPos, wallBlock);
placed.add(wallPos);
@ -164,7 +164,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
bpos.setY(top - 1);
BlockState state = world.getBlockState(bpos);
while (!state.is(EndTags.GEN_TERRAIN) && bpos.getY() > 5) {
while (!state.is(TagAPI.GEN_TERRAIN) && bpos.getY() > 5) {
bpos.setY(bpos.getY() - 1);
state = world.getBlockState(bpos);
}
@ -173,7 +173,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
}
top = (int) (bpos.getY() - (radius * 1.3F + 5));
while (state.is(EndTags.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) {
while (state.is(TagAPI.GEN_TERRAIN) || !state.getFluidState().isEmpty() && bpos.getY() > 5) {
bpos.setY(bpos.getY() - 1);
state = world.getBlockState(bpos);
}

View file

@ -10,9 +10,9 @@ 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.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
public class RoundCaveFeature extends EndCaveFeature {
@ -76,7 +76,7 @@ public class RoundCaveFeature extends EndCaveFeature {
}
private boolean isReplaceable(BlockState state) {
return state.is(EndTags.GEN_TERRAIN)
return state.is(TagAPI.GEN_TERRAIN)
|| state.getMaterial().isReplaceable()
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.LEAVES);

View file

@ -18,9 +18,9 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.TagAPI;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.biome.cave.EndCaveBiome;
@ -53,7 +53,7 @@ public class TunelCaveFeature extends EndCaveFeature {
float vert = Mth.sin((y + (float) noiseV.eval(x * 0.01, z * 0.01) * 20) * 0.1F) * 0.9F;
float dist = (float) noiseD.eval(x * 0.1, y * 0.1, z * 0.1) * 0.12F;
vert *= vert;
if (val + vert + dist < 0.15 && world.getBlockState(pos).is(EndTags.GEN_TERRAIN) && noWaterNear(world, pos)) {
if (val + vert + dist < 0.15 && world.getBlockState(pos).is(TagAPI.GEN_TERRAIN) && noWaterNear(world, pos)) {
BlocksHelper.setWithoutUpdate(world, pos, AIR);
positions.add(pos.immutable());
int height = world.getHeight(Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
@ -115,7 +115,7 @@ public class TunelCaveFeature extends EndCaveFeature {
}
else if (world.getBlockState(mut).getMaterial().isReplaceable()) {
mut.setY(bpos.getY() - 1);
if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) {
Set<BlockPos> floorPositions = floorSets.get(bio);
if (floorPositions == null) {
floorPositions = Sets.newHashSet();
@ -124,7 +124,7 @@ public class TunelCaveFeature extends EndCaveFeature {
floorPositions.add(mut.immutable());
}
mut.setY(bpos.getY() + 1);
if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(mut).is(TagAPI.GEN_TERRAIN)) {
Set<BlockPos> ceilPositions = ceilSets.get(bio);
if (ceilPositions == null) {
ceilPositions = Sets.newHashSet();