Compare commits
2 commits
9649d204e5
...
e49a692261
Author | SHA1 | Date | |
---|---|---|---|
e49a692261 | |||
6c7be0f151 |
6 changed files with 127 additions and 27 deletions
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"type": "minecraft:random_patch",
|
||||
"config": {
|
||||
"feature": {
|
||||
"feature": {
|
||||
"type": "minecraft:simple_block",
|
||||
"config": {
|
||||
"to_place": {
|
||||
"type": "minecraft:simple_state_provider",
|
||||
"state": {
|
||||
"Name": "roses_mod:cyan_rose_bush",
|
||||
"Properties": {
|
||||
"half": "lower"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:block_predicate_filter",
|
||||
"predicate": {
|
||||
"type": "minecraft:matching_blocks",
|
||||
"blocks": "minecraft:air"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tries": 96,
|
||||
"xz_spread": 7,
|
||||
"y_spread": 3
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"feature": "roses_mod:cyan_rose_bush",
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:rarity_filter",
|
||||
"chance": 7
|
||||
},
|
||||
{
|
||||
"type": "minecraft:in_square"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:heightmap",
|
||||
"heightmap": "MOTION_BLOCKING"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:count",
|
||||
"count": {
|
||||
"type": "minecraft:clamped",
|
||||
"max_inclusive": 3,
|
||||
"min_inclusive": 0,
|
||||
"source": {
|
||||
"type": "minecraft:uniform",
|
||||
"max_inclusive": 3,
|
||||
"min_inclusive": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "minecraft:biome"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
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.*;
|
||||
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
|
||||
import observer.nelle.roses.RosesBlocks;
|
||||
import observer.nelle.roses.RosesModKt;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class RosesConfiguredFeatures {
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> cyanRoseBushKey = registerKey("cyan_rose_bush");
|
||||
|
||||
public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
|
||||
// pretty much exactly as FOREST_FLOWERS
|
||||
register(context, cyanRoseBushKey, Feature.RANDOM_PATCH,
|
||||
ConfiguredFeatures.createRandomPatchFeatureConfig(Feature.SIMPLE_BLOCK,
|
||||
new SimpleBlockFeatureConfig(BlockStateProvider.of(Objects.requireNonNull(RosesBlocks.INSTANCE.getCyanRoseBush())))));
|
||||
}
|
||||
|
||||
public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) {
|
||||
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(RosesModKt.MOD_ID, name));
|
||||
}
|
||||
|
||||
private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<?, ?>> context,
|
||||
RegistryKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) {
|
||||
context.register(key, new ConfiguredFeature<>(feature, configuration));
|
||||
}
|
||||
}
|
|
@ -5,28 +5,20 @@ import net.minecraft.registry.RegistryKey;
|
|||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.util.Identifier;
|
||||
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.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.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<PlacedFeature> cyanRoseBushPlacedKey = registerKey("cyan_rose_bush_placed");
|
||||
|
||||
public static void bootstrap(Registerable<PlacedFeature> 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<PlacedFeature> registerKey(String name) {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
24
MC1.20.6/src/main/kotlin/observer/nelle/roses/RosesMod.kt
Normal file
24
MC1.20.6/src/main/kotlin/observer/nelle/roses/RosesMod.kt
Normal file
|
@ -0,0 +1,24 @@
|
|||
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?")
|
||||
|
||||
// blocks
|
||||
RosesBlocks
|
||||
|
||||
// creative tab entries
|
||||
RosesCreativeTab
|
||||
|
||||
// generation
|
||||
RosesWorldGeneration.generateRosesWorldGen()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue