Private
Public Access
1
0

Created patch_firefly_bush_near_water_swamp.

This commit is contained in:
2025-06-06 04:07:21 +01:00
parent 5f7240bde0
commit 3d99dd8c01
3 changed files with 120 additions and 0 deletions

View File

@ -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
]
}
]
}
]
}
}
]
}

View File

@ -17,6 +17,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 void bootstrap(BootstapContext<BiomeModifier> context) {
HolderGetter<PlacedFeature> placedFeatures = context.lookup(Registries.PLACED_FEATURE);
@ -27,6 +28,12 @@ public class ModBiomeModifiers {
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
));
}
private static ResourceKey<BiomeModifier> registerKey(String name) {

View File

@ -1,20 +1,26 @@
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.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 void bootstrap(BootstapContext<PlacedFeature> context) {
HolderGetter<ConfiguredFeature<?, ?>> configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
@ -25,6 +31,23 @@ public class ModPlacedFeatures {
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))
)
))
));
}
private static ResourceKey<PlacedFeature> registerKey(String name) {