Application of Behaviours and Tags as replacement for Materials

This commit is contained in:
Frank 2023-05-24 23:09:21 +02:00
parent 6713e03088
commit 4bf32937c1
60 changed files with 237 additions and 350 deletions

View file

@ -2,6 +2,7 @@ package org.betterx.betterend.integration.byg.features;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.sdf.SDF;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper;
import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.integration.Integrations;
@ -14,7 +15,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import com.google.common.base.Function;
import org.joml.Vector3f;
@ -34,9 +34,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
return state.is(CommonBlockTags.END_STONES) || BlocksHelper.replaceableOrPlant(state);
};
int height = MHelper.randRange(40, 60, random);
@ -66,9 +64,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
}
sdf.setReplaceFunction((state) -> {
return state.is(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
return state.is(CommonBlockTags.END_STONES) || BlocksHelper.replaceableOrPlant(state);
}).addPostProcess((info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
return wood;

View file

@ -25,7 +25,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
@ -48,9 +47,8 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
BlockState leaves_flower = Integrations.BYG.getDefaultState("flowering_nightshade_leaves");
Function<BlockPos, BlockState> splinePlacer = (bpos) -> log;
Function<BlockState, Boolean> replace = (state) -> state.is(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
Function<BlockState, Boolean> replace = (state) -> state.is(CommonBlockTags.END_STONES)
|| BlocksHelper.replaceableOrPlant(state);
Function<PosInfo, BlockState> post = (info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
return wood;

View file

@ -7,6 +7,7 @@ import org.betterx.bclib.sdf.operator.SDFSubtraction;
import org.betterx.bclib.sdf.operator.SDFTranslate;
import org.betterx.bclib.sdf.operator.SDFUnion;
import org.betterx.bclib.sdf.primitive.SDFSphere;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper;
import org.betterx.bclib.util.SplineHelper;
import org.betterx.betterend.integration.Integrations;
@ -21,7 +22,6 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.phys.AABB;
import com.google.common.collect.Lists;
@ -52,11 +52,10 @@ 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(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT)) {
if (state.equals(stem) || state.equals(wood) || state.is(CommonBlockTags.END_STONES)) {
return true;
}
return state.getMaterial().isReplaceable();
return BlocksHelper.replaceableOrPlant(state);
};
float size = MHelper.randRange(10, 20, random);