Tree fixes

This commit is contained in:
paulevsGitch 2021-12-23 09:47:34 +03:00
parent d0b23a9c9f
commit affd63646a
11 changed files with 35 additions and 36 deletions

View file

@ -277,7 +277,7 @@ public class EndFeatures {
} }
private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLCommonFeatures.makeChancedFeature(BetterEnd.makeID(name), Decoration.RAW_GENERATION, feature, chance); return BCLCommonFeatures.makeChancedFeature(BetterEnd.makeID(name), Decoration.LAKES, feature, chance);
} }
private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) {

View file

@ -5,6 +5,7 @@ import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -45,7 +46,7 @@ public class DragonTreeFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
float size = MHelper.randRange(10, 25, random); float size = MHelper.randRange(10, 25, random);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 6); List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 6);
@ -195,9 +196,9 @@ public class DragonTreeFeature extends DefaultFeature {
static { static {
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND)) { /*if (state.is(TagAPI.BLOCK_END_GROUND)) {
return true; return true;
} }*/
if (state.getBlock() == EndBlocks.DRAGON_TREE_LEAVES) { if (state.getBlock() == EndBlocks.DRAGON_TREE_LEAVES) {
return true; return true;
} }

View file

@ -6,13 +6,13 @@ import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.blocks.BaseAttachedBlock; import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.PosInfo;
import ru.bclib.sdf.SDF; import ru.bclib.sdf.SDF;
@ -36,7 +36,7 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
float size = MHelper.randRange(5, 10, random); float size = MHelper.randRange(5, 10, random);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 5); List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 5);
@ -361,7 +361,7 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
static { static {
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial().equals(Material.PLANT)) { if (/*state.is(TagAPI.BLOCK_END_GROUND) || */state.getMaterial().equals(Material.PLANT)) {
return true; return true;
} }
return state.getMaterial().isReplaceable(); return state.getMaterial().isReplaceable();

View file

@ -3,13 +3,13 @@ package ru.betterend.world.features.trees;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.PosInfo;
import ru.bclib.sdf.SDF; import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFRotation; import ru.bclib.sdf.operator.SDFRotation;
@ -37,7 +37,7 @@ public class HelixTreeFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
BlocksHelper.setWithoutUpdate(world, pos, AIR); BlocksHelper.setWithoutUpdate(world, pos, AIR);
float angle = random.nextFloat() * MHelper.PI2; float angle = random.nextFloat() * MHelper.PI2;

View file

@ -3,6 +3,7 @@ package ru.betterend.world.features.trees;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -36,7 +37,7 @@ public class JellyshroomFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
BlockState bark = EndBlocks.JELLYSHROOM.getBark().defaultBlockState(); BlockState bark = EndBlocks.JELLYSHROOM.getBark().defaultBlockState();
BlockState membrane = EndBlocks.JELLYSHROOM_CAP_PURPLE.defaultBlockState(); BlockState membrane = EndBlocks.JELLYSHROOM_CAP_PURPLE.defaultBlockState();
@ -122,7 +123,7 @@ public class JellyshroomFeature extends DefaultFeature {
SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0)); SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0));
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial().equals(Material.PLANT)) { if (/*state.is(TagAPI.BLOCK_END_GROUND) || */state.getMaterial().equals(Material.PLANT)) {
return true; return true;
} }
return state.getMaterial().isReplaceable(); return state.getMaterial().isReplaceable();

View file

@ -4,6 +4,7 @@ import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -38,7 +39,7 @@ public class LacugroveFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
float size = MHelper.randRange(15, 25, random); float size = MHelper.randRange(15, 25, random);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 6); List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 6);
@ -188,9 +189,9 @@ public class LacugroveFeature extends DefaultFeature {
static { static {
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND)) { /*if (state.is(TagAPI.BLOCK_END_GROUND)) {
return true; return true;
} }*/
if (EndBlocks.LACUGROVE.isTreeLog(state)) { if (EndBlocks.LACUGROVE.isTreeLog(state)) {
return true; return true;
} }

View file

@ -5,6 +5,7 @@ import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -46,7 +47,7 @@ public class LucerniaFeature extends DefaultFeature {
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
final NoneFeatureConfiguration config = featureConfig.config(); final NoneFeatureConfiguration config = featureConfig.config();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
float size = MHelper.randRange(12, 20, random); float size = MHelper.randRange(12, 20, random);
int count = (int) (size * 0.3F); int count = (int) (size * 0.3F);
@ -194,9 +195,9 @@ public class LucerniaFeature extends DefaultFeature {
static { static {
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND)) { /*if (state.is(TagAPI.BLOCK_END_GROUND)) {
return true; return true;
} }*/
if (state.getBlock() == EndBlocks.LUCERNIA_LEAVES) { if (state.getBlock() == EndBlocks.LUCERNIA_LEAVES) {
return true; return true;
} }

View file

@ -8,7 +8,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.SDF; import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFBinary; import ru.bclib.sdf.operator.SDFBinary;
import ru.bclib.sdf.operator.SDFCoordModify; import ru.bclib.sdf.operator.SDFCoordModify;
@ -172,9 +171,9 @@ public class MossyGlowshroomFeature extends DefaultFeature {
.setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS_ROT)); .setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS_ROT));
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND)) { /*if (state.is(TagAPI.BLOCK_END_GROUND)) {
return true; return true;
} }*/
if (state.getMaterial().equals(Material.PLANT)) { if (state.getMaterial().equals(Material.PLANT)) {
return true; return true;
} }

View file

@ -10,7 +10,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.sdf.PosInfo; import ru.bclib.sdf.PosInfo;
import ru.bclib.sdf.SDF; import ru.bclib.sdf.SDF;
import ru.bclib.sdf.operator.SDFDisplacement; import ru.bclib.sdf.operator.SDFDisplacement;
@ -188,9 +187,9 @@ public class PythadendronTreeFeature extends DefaultFeature {
static { static {
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND)) { /*if (state.is(TagAPI.BLOCK_END_GROUND)) {
return true; return true;
} }*/
if (state.getBlock() == EndBlocks.PYTHADENDRON_LEAVES) { if (state.getBlock() == EndBlocks.PYTHADENDRON_LEAVES) {
return true; return true;
} }

View file

@ -5,13 +5,13 @@ import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.api.TagAPI;
import ru.bclib.blocks.BlockProperties; import ru.bclib.blocks.BlockProperties;
import ru.bclib.blocks.BlockProperties.TripleShape; import ru.bclib.blocks.BlockProperties.TripleShape;
import ru.bclib.sdf.SDF; import ru.bclib.sdf.SDF;
@ -44,7 +44,7 @@ public class TenaneaFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
float size = MHelper.randRange(7, 10, random); float size = MHelper.randRange(7, 10, random);
int count = (int) (size * 0.45F); int count = (int) (size * 0.45F);
@ -175,9 +175,9 @@ public class TenaneaFeature extends DefaultFeature {
static { static {
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND)) { /*if (state.is(TagAPI.BLOCK_END_GROUND)) {
return true; return true;
} }*/
if (state.getBlock() == EndBlocks.TENANEA_LEAVES) { if (state.getBlock() == EndBlocks.TENANEA_LEAVES) {
return true; return true;
} }

View file

@ -5,6 +5,7 @@ import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -44,15 +45,12 @@ public class UmbrellaTreeFeature extends DefaultFeature {
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
final NoneFeatureConfiguration config = featureConfig.config(); final NoneFeatureConfiguration config = featureConfig.config();
if (!world.getBlockState(pos.below()).is(TagAPI.BLOCK_END_GROUND)) return false; if (!world.getBlockState(pos.below()).is(BlockTags.NYLIUM)) return false;
BlockState wood = EndBlocks.UMBRELLA_TREE.getBark().defaultBlockState(); BlockState wood = EndBlocks.UMBRELLA_TREE.getBark().defaultBlockState();
BlockState membrane = EndBlocks.UMBRELLA_TREE_MEMBRANE.defaultBlockState() BlockState membrane = EndBlocks.UMBRELLA_TREE_MEMBRANE.defaultBlockState().setValue(UmbrellaTreeMembraneBlock.COLOR, 1);
.setValue(UmbrellaTreeMembraneBlock.COLOR, 1); BlockState center = EndBlocks.UMBRELLA_TREE_MEMBRANE.defaultBlockState().setValue(UmbrellaTreeMembraneBlock.COLOR, 0);
BlockState center = EndBlocks.UMBRELLA_TREE_MEMBRANE.defaultBlockState() BlockState fruit = EndBlocks.UMBRELLA_TREE_CLUSTER.defaultBlockState().setValue(UmbrellaTreeClusterBlock.NATURAL, true);
.setValue(UmbrellaTreeMembraneBlock.COLOR, 0);
BlockState fruit = EndBlocks.UMBRELLA_TREE_CLUSTER.defaultBlockState()
.setValue(UmbrellaTreeClusterBlock.NATURAL, true);
float size = MHelper.randRange(10, 20, random); float size = MHelper.randRange(10, 20, random);
int count = (int) (size * 0.15F); int count = (int) (size * 0.15F);
@ -220,8 +218,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0)); SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0));
REPLACE = (state) -> { REPLACE = (state) -> {
if (state.is(TagAPI.BLOCK_END_GROUND) || state.getMaterial() if (/*state.is(TagAPI.BLOCK_END_GROUND) || */state.getMaterial().equals(Material.PLANT) || state.is(EndBlocks.UMBRELLA_TREE_MEMBRANE)) {
.equals(Material.PLANT) || state.is(EndBlocks.UMBRELLA_TREE_MEMBRANE)) {
return true; return true;
} }
return state.getMaterial().isReplaceable(); return state.getMaterial().isReplaceable();