Merge pull request 'feat/8-world_gen' (#11) from feat/8-world_gen into 1.20.1
Reviewed-on: #11
This commit is contained in:
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"type": "forge:add_features",
|
||||||
|
"biomes": "#minecraft:is_overworld",
|
||||||
|
"features": "firefly_bush_backport:patch_firefly_bush_near_water",
|
||||||
|
"step": "vegetal_decoration"
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"type": "forge:add_features",
|
||||||
|
"biomes": "#forge:is_swamp",
|
||||||
|
"features": "firefly_bush_backport:patch_firefly_bush_near_water_swamp",
|
||||||
|
"step": "vegetal_decoration"
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"type": "forge:add_features",
|
||||||
|
"biomes": "#forge:is_swamp",
|
||||||
|
"features": "firefly_bush_backport:patch_firefly_bush_swamp",
|
||||||
|
"step": "vegetal_decoration"
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:random_patch",
|
||||||
|
"config": {
|
||||||
|
"feature": {
|
||||||
|
"feature": {
|
||||||
|
"type": "minecraft:simple_block",
|
||||||
|
"config": {
|
||||||
|
"to_place": {
|
||||||
|
"type": "minecraft:simple_state_provider",
|
||||||
|
"state": {
|
||||||
|
"Name": "firefly_bush_backport:firefly_bush"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:block_predicate_filter",
|
||||||
|
"predicate": {
|
||||||
|
"type": "minecraft:matching_blocks",
|
||||||
|
"blocks": "minecraft:air"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tries": 20,
|
||||||
|
"xz_spread": 4,
|
||||||
|
"y_spread": 3
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
"feature": "firefly_bush_backport:patch_firefly_bush",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:count",
|
||||||
|
"count": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "MOTION_BLOCKING_NO_LEAVES"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:block_predicate_filter",
|
||||||
|
"predicate": {
|
||||||
|
"type": "minecraft:all_of",
|
||||||
|
"predicates": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_blocks",
|
||||||
|
"blocks": "minecraft:air"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:would_survive",
|
||||||
|
"state": {
|
||||||
|
"Name": "firefly_bush_backport:firefly_bush"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:any_of",
|
||||||
|
"predicates": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
1,
|
||||||
|
-1,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
-1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
"feature": "firefly_bush_backport:patch_firefly_bush",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:count",
|
||||||
|
"count": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "MOTION_BLOCKING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:block_predicate_filter",
|
||||||
|
"predicate": {
|
||||||
|
"type": "minecraft:all_of",
|
||||||
|
"predicates": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_blocks",
|
||||||
|
"blocks": "minecraft:air"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:would_survive",
|
||||||
|
"state": {
|
||||||
|
"Name": "firefly_bush_backport:firefly_bush"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:any_of",
|
||||||
|
"predicates": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
1,
|
||||||
|
-1,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:matching_fluids",
|
||||||
|
"fluids": [
|
||||||
|
"minecraft:water",
|
||||||
|
"minecraft:flowing_water"
|
||||||
|
],
|
||||||
|
"offset": [
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
-1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"feature": "firefly_bush_backport:patch_firefly_bush",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:rarity_filter",
|
||||||
|
"chance": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "MOTION_BLOCKING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -4,21 +4,27 @@ import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
|||||||
import dev.micle.firefly_bush_backport.data.client.ModBlockStateProvider;
|
import dev.micle.firefly_bush_backport.data.client.ModBlockStateProvider;
|
||||||
import dev.micle.firefly_bush_backport.data.client.ModItemModelProvider;
|
import dev.micle.firefly_bush_backport.data.client.ModItemModelProvider;
|
||||||
import dev.micle.firefly_bush_backport.data.client.ModSoundDefinitionsProvider;
|
import dev.micle.firefly_bush_backport.data.client.ModSoundDefinitionsProvider;
|
||||||
|
import dev.micle.firefly_bush_backport.data.server.ModWorldGenProvider;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.data.DataGenerator;
|
import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.data.event.GatherDataEvent;
|
import net.minecraftforge.data.event.GatherDataEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid = FireflyBushBackport.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = FireflyBushBackport.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class DataGenerators {
|
public class DataGenerators {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void gatherData(GatherDataEvent event) {
|
public static void gatherData(GatherDataEvent event) {
|
||||||
DataGenerator generator = event.getGenerator();
|
DataGenerator generator = event.getGenerator();
|
||||||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
||||||
|
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
|
||||||
|
|
||||||
generator.addProvider(event.includeClient(), new ModBlockStateProvider(generator, existingFileHelper));
|
generator.addProvider(event.includeClient(), new ModBlockStateProvider(generator, existingFileHelper));
|
||||||
generator.addProvider(event.includeClient(), new ModItemModelProvider(generator, existingFileHelper));
|
generator.addProvider(event.includeClient(), new ModItemModelProvider(generator, existingFileHelper));
|
||||||
generator.addProvider(event.includeClient(), new ModSoundDefinitionsProvider(generator, existingFileHelper));
|
generator.addProvider(event.includeClient(), new ModSoundDefinitionsProvider(generator, existingFileHelper));
|
||||||
|
generator.addProvider(event.includeServer(), new ModWorldGenProvider(generator, lookupProvider));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package dev.micle.firefly_bush_backport.data.server;
|
||||||
|
|
||||||
|
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
||||||
|
import dev.micle.firefly_bush_backport.worldgen.ModBiomeModifiers;
|
||||||
|
import dev.micle.firefly_bush_backport.worldgen.ModConfiguredFeatures;
|
||||||
|
import dev.micle.firefly_bush_backport.worldgen.ModPlacedFeatures;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.core.RegistrySetBuilder;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.data.DataGenerator;
|
||||||
|
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class ModWorldGenProvider extends DatapackBuiltinEntriesProvider {
|
||||||
|
public static final RegistrySetBuilder BUILDER = new RegistrySetBuilder()
|
||||||
|
.add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap)
|
||||||
|
.add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap)
|
||||||
|
.add(ForgeRegistries.Keys.BIOME_MODIFIERS, ModBiomeModifiers::bootstrap);
|
||||||
|
|
||||||
|
public ModWorldGenProvider(DataGenerator generator, CompletableFuture<HolderLookup.Provider> registries) {
|
||||||
|
super(generator.getPackOutput(), registries, BUILDER, Set.of(FireflyBushBackport.MOD_ID));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package dev.micle.firefly_bush_backport.worldgen;
|
||||||
|
|
||||||
|
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
||||||
|
import net.minecraft.core.HolderGetter;
|
||||||
|
import net.minecraft.core.HolderSet;
|
||||||
|
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;
|
||||||
|
import net.minecraftforge.common.Tags;
|
||||||
|
import net.minecraftforge.common.world.BiomeModifier;
|
||||||
|
import net.minecraftforge.common.world.ForgeBiomeModifiers;
|
||||||
|
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);
|
||||||
|
HolderGetter<Biome> biomes = context.lookup(Registries.BIOME);
|
||||||
|
|
||||||
|
context.register(ADD_PATCH_FIREFLY_BUSH_SWAMP, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
|
||||||
|
biomes.getOrThrow(Tags.Biomes.IS_SWAMP),
|
||||||
|
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.PATCH_FIREFLY_BUSH_SWAMP_PLACED_KEY)),
|
||||||
|
GenerationStep.Decoration.VEGETAL_DECORATION
|
||||||
|
));
|
||||||
|
|
||||||
|
context.register(ADD_PATCH_FIREFLY_BUSH_NEAR_WATER_SWAMP, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
|
||||||
|
biomes.getOrThrow(Tags.Biomes.IS_SWAMP),
|
||||||
|
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) {
|
||||||
|
return ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, ResourceLocation.fromNamespaceAndPath(FireflyBushBackport.MOD_ID, name));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package dev.micle.firefly_bush_backport.worldgen;
|
||||||
|
|
||||||
|
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
||||||
|
import dev.micle.firefly_bush_backport.block.ModBlocks;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.data.worldgen.BootstapContext;
|
||||||
|
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
|
||||||
|
|
||||||
|
public class ModConfiguredFeatures {
|
||||||
|
public static final ResourceKey<ConfiguredFeature<?, ?>> PATCH_FIREFLY_BUSH_KEY = registerKey("patch_firefly_bush");
|
||||||
|
|
||||||
|
public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> context) {
|
||||||
|
register(context, PATCH_FIREFLY_BUSH_KEY, Feature.RANDOM_PATCH, new RandomPatchConfiguration(
|
||||||
|
20,
|
||||||
|
4,
|
||||||
|
3,
|
||||||
|
PlacementUtils.onlyWhenEmpty(
|
||||||
|
Feature.SIMPLE_BLOCK,
|
||||||
|
new SimpleBlockConfiguration(
|
||||||
|
SimpleStateProvider.simple(ModBlocks.FIREFLY_BUSH.get())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResourceKey<ConfiguredFeature<?, ?>> registerKey(String name) {
|
||||||
|
return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation.fromNamespaceAndPath(FireflyBushBackport.MOD_ID, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <FC extends FeatureConfiguration, F extends Feature<FC>> void register(
|
||||||
|
BootstapContext<ConfiguredFeature<?, ?>> context,
|
||||||
|
ResourceKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration
|
||||||
|
) {
|
||||||
|
context.register(key, new ConfiguredFeature<>(feature, configuration));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package dev.micle.firefly_bush_backport.worldgen;
|
||||||
|
|
||||||
|
import dev.micle.firefly_bush_backport.FireflyBushBackport;
|
||||||
|
import dev.micle.firefly_bush_backport.block.ModBlocks;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.HolderGetter;
|
||||||
|
import net.minecraft.core.Vec3i;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.data.worldgen.BootstapContext;
|
||||||
|
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.*;
|
||||||
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
register(context, PATCH_FIREFLY_BUSH_SWAMP_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.PATCH_FIREFLY_BUSH_KEY), List.of(
|
||||||
|
RarityFilter.onAverageOnceEvery(8),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
PlacementUtils.HEIGHTMAP,
|
||||||
|
BiomeFilter.biome()
|
||||||
|
));
|
||||||
|
|
||||||
|
register(context, PATCH_FIREFLY_BUSH_NEAR_WATER_SWAMP_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.PATCH_FIREFLY_BUSH_KEY), List.of(
|
||||||
|
CountPlacement.of(3),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
PlacementUtils.HEIGHTMAP,
|
||||||
|
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))
|
||||||
|
)
|
||||||
|
))
|
||||||
|
));
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation.fromNamespaceAndPath(FireflyBushBackport.MOD_ID, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void register(BootstapContext<PlacedFeature> context, ResourceKey<PlacedFeature> key, Holder<ConfiguredFeature<?, ?>> configuration, List<PlacementModifier> modifiers) {
|
||||||
|
context.register(key, new PlacedFeature(configuration, List.copyOf(modifiers)));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user