From 9649d204e56ff05c8b587589443d674dee3422f8 Mon Sep 17 00:00:00 2001 From: nelle Date: Sat, 21 Dec 2024 14:43:32 -0700 Subject: [PATCH] cyan rose bushes? --- .../roses/world/RosesConfiguredFeatures.java | 28 ------------------- .../roses/world/RosesPlacedFeatures.java | 16 ++++++++--- .../world/gen/RosesVegetationGeneration.java | 15 ++++++++++ .../kotlin/observer/nelle/roses/RosesMod.kt | 27 ------------------ 4 files changed, 27 insertions(+), 59 deletions(-) delete mode 100644 MC1.20.6/src/main/java/observer/nelle/roses/world/RosesConfiguredFeatures.java create mode 100644 MC1.20.6/src/main/java/observer/nelle/roses/world/gen/RosesVegetationGeneration.java delete mode 100644 MC1.20.6/src/main/kotlin/observer/nelle/roses/RosesMod.kt diff --git a/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesConfiguredFeatures.java b/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesConfiguredFeatures.java deleted file mode 100644 index dae9419..0000000 --- a/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesConfiguredFeatures.java +++ /dev/null @@ -1,28 +0,0 @@ -package observer.nelle.roses.world; - -// Configured Feature (flowers, how does this look like) -> Placed Feature (How is this feature placed) -> WorldGen/BiomeMod (Where is our feature placed) - -import net.minecraft.registry.Registerable; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.Feature; -import net.minecraft.world.gen.feature.FeatureConfig; -import observer.nelle.roses.RosesModKt; - -public class RosesConfiguredFeatures { - public static void bootstrap(Registerable> context) { - - } - - - public static RegistryKey> registerKey(String name) { - return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(RosesModKt.MOD_ID, name)); - } - - private static > void register(Registerable> context, - RegistryKey> key, F feature, FC configuration) { - context.register(key, new ConfiguredFeature<>(feature, configuration)); - } -} diff --git a/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesPlacedFeatures.java b/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesPlacedFeatures.java index fad8d50..075d479 100644 --- a/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesPlacedFeatures.java +++ b/MC1.20.6/src/main/java/observer/nelle/roses/world/RosesPlacedFeatures.java @@ -5,20 +5,28 @@ import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.Identifier; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.Feature; -import net.minecraft.world.gen.feature.FeatureConfig; -import net.minecraft.world.gen.feature.PlacedFeature; +import net.minecraft.util.math.intprovider.ClampedIntProvider; +import net.minecraft.util.math.intprovider.UniformIntProvider; +import net.minecraft.world.gen.feature.*; import net.minecraft.world.gen.placementmodifier.PlacementModifier; +import net.minecraft.world.gen.placementmodifier.*; import observer.nelle.roses.RosesModKt; import java.util.List; public class RosesPlacedFeatures { + public static final RegistryKey cyanRoseBushPlacedKey = registerKey("cyan_rose_bush_placed"); public static void bootstrap(Registerable context) { var configuredFeatures = context.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE); + // pretty much exactly as FOREST_FLOWERS + register(context, cyanRoseBushPlacedKey, configuredFeatures.getOrThrow(RosesConfiguredFeatures.cyanRoseBushKey), + RarityFilterPlacementModifier.of(7), + SquarePlacementModifier.of(), + PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, + CountPlacementModifier.of(ClampedIntProvider.create(UniformIntProvider.create(-1, 3), 0, 3)), + BiomePlacementModifier.of()); } public static RegistryKey registerKey(String name) { diff --git a/MC1.20.6/src/main/java/observer/nelle/roses/world/gen/RosesVegetationGeneration.java b/MC1.20.6/src/main/java/observer/nelle/roses/world/gen/RosesVegetationGeneration.java new file mode 100644 index 0000000..cc2d7b7 --- /dev/null +++ b/MC1.20.6/src/main/java/observer/nelle/roses/world/gen/RosesVegetationGeneration.java @@ -0,0 +1,15 @@ +package observer.nelle.roses.world.gen; + +import net.fabricmc.fabric.api.biome.v1.BiomeModifications; +import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; +import net.minecraft.world.biome.BiomeKeys; +import net.minecraft.world.gen.GenerationStep; +import observer.nelle.roses.world.RosesPlacedFeatures; + +public class RosesVegetationGeneration { + public static void generateVegetation() { + BiomeModifications.addFeature(BiomeSelectors.includeByKey( + BiomeKeys.PLAINS, BiomeKeys.FOREST, BiomeKeys.FLOWER_FOREST, BiomeKeys.BIRCH_FOREST, BiomeKeys.OLD_GROWTH_BIRCH_FOREST, BiomeKeys.DARK_FOREST), + GenerationStep.Feature.VEGETAL_DECORATION, RosesPlacedFeatures.cyanRoseBushPlacedKey); + } +} diff --git a/MC1.20.6/src/main/kotlin/observer/nelle/roses/RosesMod.kt b/MC1.20.6/src/main/kotlin/observer/nelle/roses/RosesMod.kt deleted file mode 100644 index c420c75..0000000 --- a/MC1.20.6/src/main/kotlin/observer/nelle/roses/RosesMod.kt +++ /dev/null @@ -1,27 +0,0 @@ -package observer.nelle.roses - -import net.fabricmc.api.ModInitializer -import observer.nelle.roses.world.gen.RosesWorldGeneration -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -val LOGGER: Logger = LoggerFactory.getLogger("roses") -const val MOD_ID = "roses_mod" - -class Roses : ModInitializer { - override fun onInitialize() { - LOGGER.info("just like old times?") - - /* TODO: - * - register worldgen - * - biome modification - * */ - - // blocks - RosesBlocks - // creative tab entries - RosesCreativeTab - - RosesWorldGeneration.generateRosesWorldGen() - } -}