Created patch_firefly_bush_near_water.
This commit is contained in:
@ -7,6 +7,7 @@ import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.worldgen.BootstapContext;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
@ -18,6 +19,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
public class ModBiomeModifiers {
|
||||
public static final ResourceKey<BiomeModifier> ADD_PATCH_FIREFLY_BUSH_SWAMP = registerKey("add_patch_firefly_bush_swamp");
|
||||
public static final ResourceKey<BiomeModifier> ADD_PATCH_FIREFLY_BUSH_NEAR_WATER_SWAMP = registerKey("add_patch_firefly_bush_near_water_swamp");
|
||||
public static final ResourceKey<BiomeModifier> ADD_PATCH_FIREFLY_BUSH_NEAR_WATER = registerKey("add_patch_firefly_bush_near_water");
|
||||
|
||||
public static void bootstrap(BootstapContext<BiomeModifier> context) {
|
||||
HolderGetter<PlacedFeature> placedFeatures = context.lookup(Registries.PLACED_FEATURE);
|
||||
@ -34,6 +36,12 @@ public class ModBiomeModifiers {
|
||||
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.PATCH_FIREFLY_BUSH_NEAR_WATER_SWAMP_PLACED_KEY)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION
|
||||
));
|
||||
|
||||
context.register(ADD_PATCH_FIREFLY_BUSH_NEAR_WATER, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
|
||||
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
|
||||
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.PATCH_FIREFLY_BUSH_NEAR_WATER_PLACED_KEY)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION
|
||||
));
|
||||
}
|
||||
|
||||
private static ResourceKey<BiomeModifier> registerKey(String name) {
|
||||
|
@ -11,6 +11,7 @@ import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.*;
|
||||
@ -21,6 +22,7 @@ import java.util.List;
|
||||
public class ModPlacedFeatures {
|
||||
public static final ResourceKey<PlacedFeature> PATCH_FIREFLY_BUSH_SWAMP_PLACED_KEY = registerKey("patch_firefly_bush_swamp");
|
||||
public static final ResourceKey<PlacedFeature> PATCH_FIREFLY_BUSH_NEAR_WATER_SWAMP_PLACED_KEY = registerKey("patch_firefly_bush_near_water_swamp");
|
||||
public static final ResourceKey<PlacedFeature> PATCH_FIREFLY_BUSH_NEAR_WATER_PLACED_KEY = registerKey("patch_firefly_bush_near_water");
|
||||
|
||||
public static void bootstrap(BootstapContext<PlacedFeature> context) {
|
||||
HolderGetter<ConfiguredFeature<?, ?>> configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
|
||||
@ -48,6 +50,23 @@ public class ModPlacedFeatures {
|
||||
)
|
||||
))
|
||||
));
|
||||
|
||||
register(context, PATCH_FIREFLY_BUSH_NEAR_WATER_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.PATCH_FIREFLY_BUSH_KEY), List.of(
|
||||
CountPlacement.of(2),
|
||||
InSquarePlacement.spread(),
|
||||
HeightmapPlacement.onHeightmap(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES),
|
||||
BiomeFilter.biome(),
|
||||
BlockPredicateFilter.forPredicate(BlockPredicate.allOf(
|
||||
BlockPredicate.matchesBlocks(Blocks.AIR),
|
||||
BlockPredicate.wouldSurvive(ModBlocks.FIREFLY_BUSH.get().defaultBlockState(), Vec3i.ZERO),
|
||||
BlockPredicate.anyOf(
|
||||
BlockPredicate.matchesFluids(new Vec3i(1, -1, 0), List.of(Fluids.WATER, Fluids.FLOWING_WATER)),
|
||||
BlockPredicate.matchesFluids(new Vec3i(-1, -1, 0), List.of(Fluids.WATER, Fluids.FLOWING_WATER)),
|
||||
BlockPredicate.matchesFluids(new Vec3i(0, -1, 1), List.of(Fluids.WATER, Fluids.FLOWING_WATER)),
|
||||
BlockPredicate.matchesFluids(new Vec3i(0, -1, -1), List.of(Fluids.WATER, Fluids.FLOWING_WATER))
|
||||
)
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
private static ResourceKey<PlacedFeature> registerKey(String name) {
|
||||
|
Reference in New Issue
Block a user