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

@ -12,17 +12,17 @@ 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.util.MHelper;
import ru.bclib.util.SplineHelper;
import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags;
import ru.betterend.world.features.DefaultFeature;
public class BigEtherTreeFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
return false;
BlockState log = Integrations.BYG.getDefaultState("ether_log");
@ -31,7 +31,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
};
@ -62,7 +62,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
}
sdf.setReplaceFunction((state) -> {
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
}).addPostProcess((info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {

View file

@ -17,6 +17,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.PosInfo;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
@ -27,7 +28,6 @@ import ru.bclib.sdf.primitive.SDFSphere;
import ru.bclib.util.MHelper;
import ru.bclib.util.SplineHelper;
import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -37,7 +37,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
return false;
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
@ -50,7 +50,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
};
Function<PosInfo, BlockState> post = (info) -> {

View file

@ -17,6 +17,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.PosInfo;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
@ -27,7 +28,6 @@ import ru.bclib.sdf.primitive.SDFSphere;
import ru.bclib.util.MHelper;
import ru.bclib.util.SplineHelper;
import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.DefaultFeature;
@ -37,7 +37,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
return false;
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
@ -49,7 +49,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
};
Function<PosInfo, BlockState> post = (info) -> {

View file

@ -16,6 +16,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement;
import ru.bclib.sdf.operator.SDFSubtraction;
@ -26,7 +27,6 @@ import ru.bclib.util.MHelper;
import ru.bclib.util.SplineHelper;
import ru.betterend.integration.Integrations;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndTags;
import ru.betterend.world.features.DefaultFeature;
public class OldBulbisTreeFeature extends DefaultFeature {
@ -38,9 +38,9 @@ public class OldBulbisTreeFeature extends DefaultFeature {
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
return false;
if (!world.getBlockState(pos.below(4)).getBlock().is(EndTags.GEN_TERRAIN))
if (!world.getBlockState(pos.below(4)).getBlock().is(TagAPI.GEN_TERRAIN))
return false;
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
@ -50,7 +50,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
Function<BlockState, Boolean> replacement = (state) -> {
if (state.equals(stem) || state.equals(wood) || state.is(EndTags.END_GROUND)
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND)
|| state.getMaterial().equals(Material.PLANT)) {
return true;
}
@ -159,7 +159,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SplineHelper.rotateSpline(branch, angle);
SplineHelper.scale(branch, scale);
Vector3f last = branch.get(branch.size() - 1);
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) {
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(TagAPI.GEN_TERRAIN)) {
SplineHelper.fillSpline(branch, world, wood, pos, replacement);
}
}