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<>( return new UnregisteredBCLBiome<>(
res, res,
parent, 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.resources.ResourceLocation;
import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.util.valueproviders.UniformInt; 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.Noises;
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
import net.minecraft.world.level.levelgen.feature.Feature; 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()); 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 * 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 @Shadow
private ChunkAccess center; private ChunkAccess center;
//TODO: 1.19 Is it ok to remove this?
@Inject(method = "ensureCanWrite", at = @At("HEAD"), cancellable = true) @Inject(method = "ensureCanWrite", at = @At("HEAD"), cancellable = true)
private void be_alterBlockCheck(BlockPos blockPos, CallbackInfoReturnable<Boolean> info) { private void be_alterBlockCheck(BlockPos blockPos, CallbackInfoReturnable<Boolean> info) {
int x = blockPos.getX() >> 4; int x = blockPos.getX() >> 4;

View file

@ -16,10 +16,13 @@ import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConf
public class TestConfiguredFeatures { public class TestConfiguredFeatures {
static BCLConfigureFeature<RandomPatchFeature, RandomPatchConfiguration> YELLOW_FEATURE = BCLFeatureBuilder 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_STAINED_GLASS, 30)
.add(Blocks.YELLOW_CONCRETE_POWDER, 30) .add(Blocks.YELLOW_CONCRETE_POWDER, 30)
.add(Blocks.YELLOW_GLAZED_TERRACOTTA, 5) .add(Blocks.YELLOW_GLAZED_TERRACOTTA, 5)
.inlinePlace()
.isEmpty()
.inRandomPatch(BCLib.makeID("yellow_feature"))
.build(); .build();
public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> bootstrapContext) { 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 org.betterx.datagen.bclib.BCLibDatagen;
import net.minecraft.data.worldgen.BootstapContext; 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.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.RandomPatchFeature;
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@ -14,9 +17,11 @@ public class TestPlacedFeatures {
static BCLFeature<RandomPatchFeature, RandomPatchConfiguration> YELLOW_PLACED = TestConfiguredFeatures static BCLFeature<RandomPatchFeature, RandomPatchConfiguration> YELLOW_PLACED = TestConfiguredFeatures
.YELLOW_FEATURE .YELLOW_FEATURE
.place() .place()
.count(10)
.squarePlacement()
.onHeightmap(Heightmap.Types.WORLD_SURFACE)
.decoration(GenerationStep.Decoration.VEGETAL_DECORATION) .decoration(GenerationStep.Decoration.VEGETAL_DECORATION)
.vanillaNetherGround(8) .isEmptyAndOn(BlockPredicate.matchesBlocks(Blocks.YELLOW_CONCRETE))
.isEmptyAndOnNetherGround()
.build(); .build();
public static void bootstrap(BootstapContext<PlacedFeature> bootstrapContext) { public static void bootstrap(BootstapContext<PlacedFeature> bootstrapContext) {