Fixed for Feature assignment in biomes

This commit is contained in:
Frank 2022-12-02 23:24:29 +01:00
parent de858beff5
commit 90be8a3160
5 changed files with 21 additions and 5 deletions

View file

@ -989,7 +989,11 @@ public class BCLBiomeBuilder {
return new UnregisteredBCLBiome<>(
res,
parent,
ctx -> builder.generationSettings(fixGenerationSettings(getGeneration(ctx).build())).build()
ctx -> {
BiomeGenerationSettings.Builder genBuilder = getGeneration(ctx);
featureSupliers.forEach(s -> s.accept(genBuilder));
return builder.generationSettings(fixGenerationSettings(genBuilder.build())).build();
}
);
}
}

View file

@ -11,6 +11,7 @@ import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.Noises;
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
import net.minecraft.world.level.levelgen.feature.Feature;
@ -171,6 +172,10 @@ abstract class CommonPlacedFeatureBuilder<F extends Feature<FC>, FC extends Feat
return modifier(InSquarePlacement.spread());
}
public T onHeightmap(Heightmap.Types types) {
return modifier(HeightmapPlacement.onHeightmap(types));
}
/**
* Select random height that is 10 above min Build height and 10 below max generation height

View file

@ -17,7 +17,6 @@ public class WorldGenRegionMixin {
@Shadow
private ChunkAccess center;
//TODO: 1.19 Is it ok to remove this?
@Inject(method = "ensureCanWrite", at = @At("HEAD"), cancellable = true)
private void be_alterBlockCheck(BlockPos blockPos, CallbackInfoReturnable<Boolean> info) {
int x = blockPos.getX() >> 4;

View file

@ -16,10 +16,13 @@ import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConf
public class TestConfiguredFeatures {
static BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> YELLOW_FEATURE = BCLFeatureBuilder
.startBonemealPatch(BCLib.makeID("yellow_feature"))
.startWeighted(BCLib.makeID("temp_yellow_feature"))
.add(Blocks.YELLOW_STAINED_GLASS, 30)
.add(Blocks.YELLOW_CONCRETE_POWDER, 30)
.add(Blocks.YELLOW_GLAZED_TERRACOTTA, 5)
.inlinePlace()
.isEmpty()
.inRandomPatch(BCLib.makeID("yellow_feature"))
.build();
public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> bootstrapContext) {

View file

@ -5,7 +5,10 @@ import org.betterx.bclib.api.v3.levelgen.features.BCLFeature;
import org.betterx.datagen.bclib.BCLibDatagen;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
import net.minecraft.world.level.levelgen.feature.RandomPatchFeature;
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@ -14,9 +17,11 @@ public class TestPlacedFeatures {
static BCLFeature<RandomPatchFeature, RandomPatchConfiguration> YELLOW_PLACED = TestConfiguredFeatures
.YELLOW_FEATURE
.place()
.count(10)
.squarePlacement()
.onHeightmap(Heightmap.Types.WORLD_SURFACE)
.decoration(GenerationStep.Decoration.VEGETAL_DECORATION)
.vanillaNetherGround(8)
.isEmptyAndOnNetherGround()
.isEmptyAndOn(BlockPredicate.matchesBlocks(Blocks.YELLOW_CONCRETE))
.build();
public static void bootstrap(BootstapContext<PlacedFeature> bootstrapContext) {