mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-10-30 06:10:51 +01:00
Add Canola, Flax and Coffee patches
Fix generateQuartz config option having the wrong id
This commit is contained in:
parent
43a23883e3
commit
16cd3a6966
19 changed files with 331 additions and 4 deletions
|
@ -1,10 +1,19 @@
|
||||||
// 1.21.1 2024-08-11T19:30:01.8308187 Registries
|
// 1.21.1 2024-10-22T22:13:28.2925645 Registries
|
||||||
74628b34b75e1a2fa2ac1f6282b7d9d4e155c254 data/actuallyadditions/banner_pattern/book.json
|
74628b34b75e1a2fa2ac1f6282b7d9d4e155c254 data/actuallyadditions/banner_pattern/book.json
|
||||||
899dfa1e0d0b15ffc090605543ec144bbfcacc4c data/actuallyadditions/banner_pattern/drill.json
|
899dfa1e0d0b15ffc090605543ec144bbfcacc4c data/actuallyadditions/banner_pattern/drill.json
|
||||||
7d9a33a9a151ad83de36e9af8822d08c86137adc data/actuallyadditions/banner_pattern/leaf_blo.json
|
7d9a33a9a151ad83de36e9af8822d08c86137adc data/actuallyadditions/banner_pattern/leaf_blo.json
|
||||||
2e09aca41de0d283a4db78add64744852788bbeb data/actuallyadditions/banner_pattern/phan_con.json
|
2e09aca41de0d283a4db78add64744852788bbeb data/actuallyadditions/banner_pattern/phan_con.json
|
||||||
020d2b1f1c21d6c6663ef8126a52e2b9deb0e52e data/actuallyadditions/damage_type/atomicreconstructor.json
|
020d2b1f1c21d6c6663ef8126a52e2b9deb0e52e data/actuallyadditions/damage_type/atomicreconstructor.json
|
||||||
4ba41428fdcf03f52855029153722e22e8702823 data/actuallyadditions/neoforge/biome_modifier/add_black_quartz.json
|
4ba41428fdcf03f52855029153722e22e8702823 data/actuallyadditions/neoforge/biome_modifier/add_black_quartz.json
|
||||||
|
360756e7cd20afc4c6b2ad58b2fd4f37358f2ee6 data/actuallyadditions/neoforge/biome_modifier/add_canola.json
|
||||||
|
0f06d7aad676a45a4ca187552ac8c4bbd6f1b1b7 data/actuallyadditions/neoforge/biome_modifier/add_coffee.json
|
||||||
|
1401a66bbf2e1daaa459381103ffba9d02be352d data/actuallyadditions/neoforge/biome_modifier/add_flax.json
|
||||||
|
dceca4be717b43a4dfc945f62f5c09622604d7f4 data/actuallyadditions/worldgen/configured_feature/canola_patch.json
|
||||||
|
d56ed72dde226d9ac5eb07fa701f7a3902f1dcf2 data/actuallyadditions/worldgen/configured_feature/coffee_patch.json
|
||||||
|
9a42d5943e40d102c5e9efee988527da3622d88d data/actuallyadditions/worldgen/configured_feature/flax_patch.json
|
||||||
80765c24aa747df53139d14a9ac3293b4b3eab16 data/actuallyadditions/worldgen/configured_feature/ore_black_quartz.json
|
80765c24aa747df53139d14a9ac3293b4b3eab16 data/actuallyadditions/worldgen/configured_feature/ore_black_quartz.json
|
||||||
|
0401f9a4edd53ed76536a2c050364a6a442185bd data/actuallyadditions/worldgen/placed_feature/canola_patch.json
|
||||||
|
d7358c6519319ed3950dcdc34102504c53ccaf22 data/actuallyadditions/worldgen/placed_feature/coffee_patch.json
|
||||||
|
fb7baf3c1d721832a9b5bcea7ac7dd3ee2c50118 data/actuallyadditions/worldgen/placed_feature/flax_patch.json
|
||||||
efb41395b407edbd91712bcb63976de46fed5d04 data/actuallyadditions/worldgen/placed_feature/ore_black_quartz.json
|
efb41395b407edbd91712bcb63976de46fed5d04 data/actuallyadditions/worldgen/placed_feature/ore_black_quartz.json
|
||||||
7cf126882346a296f045db75facf741c77b7d3b1 data/actuallyadditions/worldgen/processor_list/engineer_house.json
|
7cf126882346a296f045db75facf741c77b7d3b1 data/actuallyadditions/worldgen/processor_list/engineer_house.json
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
// 1.21.1 2024-10-22T19:46:05.5548254 Update structure files in /structure
|
|
|
@ -0,0 +1 @@
|
||||||
|
// 1.21.1 2024-10-22T20:41:07.9123026 Update structure files in /structure/
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"type": "actuallyadditions:bool_config_feature_modifier",
|
||||||
|
"biomes": {
|
||||||
|
"type": "neoforge:or",
|
||||||
|
"values": [
|
||||||
|
"#c:is_hot/overworld",
|
||||||
|
"#c:is_sparse_vegetation/overworld"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"boolConfig": "generateCanola",
|
||||||
|
"features": "actuallyadditions:canola_patch",
|
||||||
|
"step": "vegetal_decoration"
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"type": "actuallyadditions:bool_config_feature_modifier",
|
||||||
|
"biomes": "#c:is_hot/overworld",
|
||||||
|
"boolConfig": "generateCoffee",
|
||||||
|
"features": "actuallyadditions:coffee_patch",
|
||||||
|
"step": "vegetal_decoration"
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"type": "actuallyadditions:bool_config_feature_modifier",
|
||||||
|
"biomes": {
|
||||||
|
"type": "neoforge:or",
|
||||||
|
"values": [
|
||||||
|
"#c:is_dense_vegetation/overworld",
|
||||||
|
"#c:is_cold/overworld"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"boolConfig": "generateFlax",
|
||||||
|
"features": "actuallyadditions:flax_patch",
|
||||||
|
"step": "vegetal_decoration"
|
||||||
|
}
|
|
@ -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": "actuallyadditions:canola",
|
||||||
|
"Properties": {
|
||||||
|
"age": "7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:block_predicate_filter",
|
||||||
|
"predicate": {
|
||||||
|
"type": "minecraft:matching_blocks",
|
||||||
|
"blocks": "minecraft:air"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tries": 10,
|
||||||
|
"xz_spread": 7,
|
||||||
|
"y_spread": 3
|
||||||
|
}
|
||||||
|
}
|
|
@ -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": "actuallyadditions:coffee",
|
||||||
|
"Properties": {
|
||||||
|
"age": "7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:block_predicate_filter",
|
||||||
|
"predicate": {
|
||||||
|
"type": "minecraft:matching_blocks",
|
||||||
|
"blocks": "minecraft:air"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tries": 6,
|
||||||
|
"xz_spread": 7,
|
||||||
|
"y_spread": 3
|
||||||
|
}
|
||||||
|
}
|
|
@ -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": "actuallyadditions:flax",
|
||||||
|
"Properties": {
|
||||||
|
"age": "7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:block_predicate_filter",
|
||||||
|
"predicate": {
|
||||||
|
"type": "minecraft:matching_blocks",
|
||||||
|
"blocks": "minecraft:air"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tries": 8,
|
||||||
|
"xz_spread": 7,
|
||||||
|
"y_spread": 3
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"feature": "actuallyadditions:canola_patch",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:rarity_filter",
|
||||||
|
"chance": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:noise_threshold_count",
|
||||||
|
"above_noise": 10,
|
||||||
|
"below_noise": 5,
|
||||||
|
"noise_level": -0.8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "WORLD_SURFACE_WG"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"feature": "actuallyadditions:coffee_patch",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:rarity_filter",
|
||||||
|
"chance": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:noise_threshold_count",
|
||||||
|
"above_noise": 10,
|
||||||
|
"below_noise": 5,
|
||||||
|
"noise_level": -0.8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "WORLD_SURFACE_WG"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"feature": "actuallyadditions:flax_patch",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:rarity_filter",
|
||||||
|
"chance": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:noise_threshold_count",
|
||||||
|
"above_noise": 10,
|
||||||
|
"below_noise": 5,
|
||||||
|
"noise_level": -0.8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "WORLD_SURFACE_WG"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.registries.VanillaRegistries;
|
import net.minecraft.data.registries.VanillaRegistries;
|
||||||
import net.minecraft.world.damagesource.DamageType;
|
import net.minecraft.world.damagesource.DamageType;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.ModList;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
|
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
|
||||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
|
@ -67,7 +68,8 @@ public class ActuallyAdditionsData {
|
||||||
|
|
||||||
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
|
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
|
||||||
|
|
||||||
generator.addProvider(true, new PatchouliGenerator(packOutput, lookupProvider));
|
if (ModList.get().isLoaded("patchouli"))
|
||||||
|
generator.addProvider(true, new PatchouliGenerator(packOutput, lookupProvider));
|
||||||
|
|
||||||
generator.addProvider(true, new GlobalLootModifierGenerator(packOutput, lookupProvider));
|
generator.addProvider(true, new GlobalLootModifierGenerator(packOutput, lookupProvider));
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraft.world.level.block.CropBlock;
|
import net.minecraft.world.level.block.CropBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -17,4 +22,12 @@ public class AACrops extends CropBlock {
|
||||||
protected ItemLike getBaseSeedId() {
|
protected ItemLike getBaseSeedId() {
|
||||||
return this.itemSupplier.get();
|
return this.itemSupplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) {
|
||||||
|
if (level instanceof WorldGenRegion) {
|
||||||
|
return state.is(BlockTags.DIRT);
|
||||||
|
}
|
||||||
|
return super.mayPlaceOn(state, level, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,17 @@ public class CommonConfig {
|
||||||
|
|
||||||
public static class Worldgen {
|
public static class Worldgen {
|
||||||
public static ModConfigSpec.BooleanValue GENERATE_QUARTZ;
|
public static ModConfigSpec.BooleanValue GENERATE_QUARTZ;
|
||||||
|
public static ModConfigSpec.BooleanValue GENERATE_CANOLA;
|
||||||
|
public static ModConfigSpec.BooleanValue GENERATE_FLAX;
|
||||||
|
public static ModConfigSpec.BooleanValue GENERATE_COFFEE;
|
||||||
|
|
||||||
public static void build() {
|
public static void build() {
|
||||||
BUILDER.comment("Worldgen Settings").push("worldgenSettings");
|
BUILDER.comment("Worldgen Settings").push("worldgenSettings");
|
||||||
|
|
||||||
GENERATE_QUARTZ = BUILDER.comment("Should Black Quartz generate in the world?").define("laserRelayLoss", true);
|
GENERATE_QUARTZ = BUILDER.comment("Should Black Quartz generate in the world?").define("generateQuartz", true);
|
||||||
|
GENERATE_CANOLA = BUILDER.comment("Should Canola generate in the World?").define("generateCanola", true);
|
||||||
|
GENERATE_FLAX = BUILDER.comment("Should Flax generate in the world?").define("generateFlax", true);
|
||||||
|
GENERATE_COFFEE = BUILDER.comment("Should Coffee generate in the world?").define("generateCoffee", true);
|
||||||
|
|
||||||
BUILDER.pop();
|
BUILDER.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,14 @@ import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
|
import net.neoforged.neoforge.common.Tags;
|
||||||
import net.neoforged.neoforge.common.conditions.ICondition;
|
import net.neoforged.neoforge.common.conditions.ICondition;
|
||||||
import net.neoforged.neoforge.common.world.BiomeModifier;
|
import net.neoforged.neoforge.common.world.BiomeModifier;
|
||||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||||
|
import net.neoforged.neoforge.registries.holdersets.AndHolderSet;
|
||||||
|
import net.neoforged.neoforge.registries.holdersets.OrHolderSet;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -46,6 +49,12 @@ public final class ActuallyBiomeModifiers {
|
||||||
|
|
||||||
protected static final ResourceKey<BiomeModifier> ADD_BLACK_QUARTZ_ORE_MODIFIER = ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS,
|
protected static final ResourceKey<BiomeModifier> ADD_BLACK_QUARTZ_ORE_MODIFIER = ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS,
|
||||||
ActuallyAdditions.modLoc("add_black_quartz"));
|
ActuallyAdditions.modLoc("add_black_quartz"));
|
||||||
|
protected static final ResourceKey<BiomeModifier> ADD_CANOLA = ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS,
|
||||||
|
ActuallyAdditions.modLoc("add_canola"));
|
||||||
|
protected static final ResourceKey<BiomeModifier> ADD_FLAX = ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS,
|
||||||
|
ActuallyAdditions.modLoc("add_flax"));
|
||||||
|
protected static final ResourceKey<BiomeModifier> ADD_COFFEE = ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS,
|
||||||
|
ActuallyAdditions.modLoc("add_coffee"));
|
||||||
|
|
||||||
public static void bootstrap(BootstrapContext<BiomeModifier> context) {
|
public static void bootstrap(BootstrapContext<BiomeModifier> context) {
|
||||||
HolderGetter<Biome> biomeGetter = context.lookup(Registries.BIOME);
|
HolderGetter<Biome> biomeGetter = context.lookup(Registries.BIOME);
|
||||||
|
@ -58,5 +67,20 @@ public final class ActuallyBiomeModifiers {
|
||||||
HolderSet.direct(placedGetter.getOrThrow(ActuallyPlacedFeatures.PLACED_ORE_BLACK_QUARTZ)),
|
HolderSet.direct(placedGetter.getOrThrow(ActuallyPlacedFeatures.PLACED_ORE_BLACK_QUARTZ)),
|
||||||
GenerationStep.Decoration.UNDERGROUND_ORES, "generateQuartz"
|
GenerationStep.Decoration.UNDERGROUND_ORES, "generateQuartz"
|
||||||
));
|
));
|
||||||
|
context.register(ADD_CANOLA, new BoolConfigFeatureBiomeModifier(
|
||||||
|
new OrHolderSet<>(biomeGetter.getOrThrow(Tags.Biomes.IS_HOT_OVERWORLD), biomeGetter.getOrThrow(Tags.Biomes.IS_SPARSE_VEGETATION_OVERWORLD)),
|
||||||
|
HolderSet.direct(placedGetter.getOrThrow(ActuallyPlacedFeatures.CANOLA_PATCH)),
|
||||||
|
GenerationStep.Decoration.VEGETAL_DECORATION, "generateCanola"
|
||||||
|
));
|
||||||
|
context.register(ADD_FLAX, new BoolConfigFeatureBiomeModifier(
|
||||||
|
new OrHolderSet<>(biomeGetter.getOrThrow(Tags.Biomes.IS_DENSE_VEGETATION_OVERWORLD), biomeGetter.getOrThrow(Tags.Biomes.IS_COLD_OVERWORLD)),
|
||||||
|
HolderSet.direct(placedGetter.getOrThrow(ActuallyPlacedFeatures.FLAX_PATCH)),
|
||||||
|
GenerationStep.Decoration.VEGETAL_DECORATION, "generateFlax"
|
||||||
|
));
|
||||||
|
context.register(ADD_COFFEE, new BoolConfigFeatureBiomeModifier(
|
||||||
|
biomeGetter.getOrThrow(Tags.Biomes.IS_HOT_OVERWORLD),
|
||||||
|
HolderSet.direct(placedGetter.getOrThrow(ActuallyPlacedFeatures.COFFEE_PATCH)),
|
||||||
|
GenerationStep.Decoration.VEGETAL_DECORATION, "generateCoffee"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.gen;
|
package de.ellpeck.actuallyadditions.mod.gen;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlock;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.data.worldgen.BootstrapContext;
|
import net.minecraft.data.worldgen.BootstrapContext;
|
||||||
import net.minecraft.data.worldgen.features.FeatureUtils;
|
import net.minecraft.data.worldgen.features.FeatureUtils;
|
||||||
|
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||||
|
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.BlockStateProvider;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
|
||||||
|
|
||||||
|
@ -17,6 +26,9 @@ import java.util.List;
|
||||||
|
|
||||||
public class ActuallyConfiguredFeatures {
|
public class ActuallyConfiguredFeatures {
|
||||||
public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_BLACK_QUARTZ = createKey("ore_black_quartz");
|
public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_BLACK_QUARTZ = createKey("ore_black_quartz");
|
||||||
|
public static final ResourceKey<ConfiguredFeature<?, ?>> CANOLA_PATCH = createKey("canola_patch");
|
||||||
|
public static final ResourceKey<ConfiguredFeature<?, ?>> FLAX_PATCH = createKey("flax_patch");
|
||||||
|
public static final ResourceKey<ConfiguredFeature<?, ?>> COFFEE_PATCH = createKey("coffee_patch");
|
||||||
|
|
||||||
public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) {
|
public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) {
|
||||||
RuleTest stoneRuleTest = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES);
|
RuleTest stoneRuleTest = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES);
|
||||||
|
@ -26,6 +38,16 @@ public class ActuallyConfiguredFeatures {
|
||||||
OreConfiguration.target(deepslateRuleTest, ActuallyBlocks.BLACK_QUARTZ_ORE.get().defaultBlockState())
|
OreConfiguration.target(deepslateRuleTest, ActuallyBlocks.BLACK_QUARTZ_ORE.get().defaultBlockState())
|
||||||
);
|
);
|
||||||
FeatureUtils.register(context, ORE_BLACK_QUARTZ, Feature.ORE, new OreConfiguration(list, 6));
|
FeatureUtils.register(context, ORE_BLACK_QUARTZ, Feature.ORE, new OreConfiguration(list, 6));
|
||||||
|
FeatureUtils.register(context, CANOLA_PATCH, Feature.RANDOM_PATCH, plantPatch(ActuallyBlocks.CANOLA.get(), 10));
|
||||||
|
FeatureUtils.register(context, FLAX_PATCH, Feature.RANDOM_PATCH, plantPatch(ActuallyBlocks.FLAX.get(), 8));
|
||||||
|
FeatureUtils.register(context, COFFEE_PATCH, Feature.RANDOM_PATCH, plantPatch(ActuallyBlocks.COFFEE.get(), 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RandomPatchConfiguration plantPatch(Block crop, int tries) {
|
||||||
|
BlockStateProvider stateProvider = BlockStateProvider.simple(crop.defaultBlockState().setValue(AACrops.AGE, AACrops.MAX_AGE));
|
||||||
|
return FeatureUtils.simpleRandomPatchConfiguration(
|
||||||
|
tries, PlacementUtils.onlyWhenEmpty(Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(stateProvider))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResourceKey<ConfiguredFeature<?, ?>> createKey(String name) {
|
private static ResourceKey<ConfiguredFeature<?, ?>> createKey(String name) {
|
||||||
|
|
|
@ -4,27 +4,65 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import net.minecraft.core.HolderGetter;
|
import net.minecraft.core.HolderGetter;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.data.worldgen.BootstrapContext;
|
import net.minecraft.data.worldgen.BootstrapContext;
|
||||||
|
import net.minecraft.data.worldgen.features.VegetationFeatures;
|
||||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.world.item.Rarity;
|
||||||
import net.minecraft.world.level.levelgen.VerticalAnchor;
|
import net.minecraft.world.level.levelgen.VerticalAnchor;
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
|
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
|
||||||
import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
||||||
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
|
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
|
||||||
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
|
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.NoiseThresholdCountPlacement;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.RarityFilter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ActuallyPlacedFeatures {
|
public class ActuallyPlacedFeatures {
|
||||||
public static final ResourceKey<PlacedFeature> PLACED_ORE_BLACK_QUARTZ = createKey("ore_black_quartz");
|
public static final ResourceKey<PlacedFeature> PLACED_ORE_BLACK_QUARTZ = createKey("ore_black_quartz");
|
||||||
|
public static final ResourceKey<PlacedFeature> CANOLA_PATCH = createKey("canola_patch");
|
||||||
|
public static final ResourceKey<PlacedFeature> FLAX_PATCH = createKey("flax_patch");
|
||||||
|
public static final ResourceKey<PlacedFeature> COFFEE_PATCH = createKey("coffee_patch");
|
||||||
|
|
||||||
public static void bootstrap(BootstrapContext<PlacedFeature> context) {
|
public static void bootstrap(BootstrapContext<PlacedFeature> context) {
|
||||||
HolderGetter<ConfiguredFeature<?, ?>> holdergetter = context.lookup(Registries.CONFIGURED_FEATURE);
|
HolderGetter<ConfiguredFeature<?, ?>> holdergetter = context.lookup(Registries.CONFIGURED_FEATURE);
|
||||||
|
|
||||||
PlacementUtils.register(context, PLACED_ORE_BLACK_QUARTZ, holdergetter.getOrThrow(ActuallyConfiguredFeatures.ORE_BLACK_QUARTZ),
|
PlacementUtils.register(context, PLACED_ORE_BLACK_QUARTZ, holdergetter.getOrThrow(ActuallyConfiguredFeatures.ORE_BLACK_QUARTZ),
|
||||||
commonOrePlacement(8, HeightRangePlacement.triangle(VerticalAnchor.absolute(-25), VerticalAnchor.absolute(45))));
|
commonOrePlacement(8, HeightRangePlacement.triangle(VerticalAnchor.absolute(-25), VerticalAnchor.absolute(45))));
|
||||||
|
|
||||||
|
PlacementUtils.register(
|
||||||
|
context,
|
||||||
|
CANOLA_PATCH,
|
||||||
|
holdergetter.getOrThrow(ActuallyConfiguredFeatures.CANOLA_PATCH),
|
||||||
|
RarityFilter.onAverageOnceEvery(8),
|
||||||
|
NoiseThresholdCountPlacement.of(-0.8, 5, 10),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
PlacementUtils.HEIGHTMAP_WORLD_SURFACE,
|
||||||
|
BiomeFilter.biome()
|
||||||
|
);
|
||||||
|
PlacementUtils.register(
|
||||||
|
context,
|
||||||
|
FLAX_PATCH,
|
||||||
|
holdergetter.getOrThrow(ActuallyConfiguredFeatures.FLAX_PATCH),
|
||||||
|
RarityFilter.onAverageOnceEvery(8),
|
||||||
|
NoiseThresholdCountPlacement.of(-0.8, 5, 10),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
PlacementUtils.HEIGHTMAP_WORLD_SURFACE,
|
||||||
|
BiomeFilter.biome()
|
||||||
|
);
|
||||||
|
PlacementUtils.register(
|
||||||
|
context,
|
||||||
|
COFFEE_PATCH,
|
||||||
|
holdergetter.getOrThrow(ActuallyConfiguredFeatures.COFFEE_PATCH),
|
||||||
|
RarityFilter.onAverageOnceEvery(8),
|
||||||
|
NoiseThresholdCountPlacement.of(-0.8, 5, 10),
|
||||||
|
InSquarePlacement.spread(),
|
||||||
|
PlacementUtils.HEIGHTMAP_WORLD_SURFACE,
|
||||||
|
BiomeFilter.biome()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<PlacementModifier> orePlacement(PlacementModifier modifier, PlacementModifier modifier1) {
|
private static List<PlacementModifier> orePlacement(PlacementModifier modifier, PlacementModifier modifier1) {
|
||||||
|
|
|
@ -29,6 +29,12 @@ public record BoolConfigFeatureBiomeModifier(HolderSet<Biome> biomes, HolderSet<
|
||||||
return true;
|
return true;
|
||||||
case "generateQuartz":
|
case "generateQuartz":
|
||||||
return CommonConfig.Worldgen.GENERATE_QUARTZ.get();
|
return CommonConfig.Worldgen.GENERATE_QUARTZ.get();
|
||||||
|
case "generateCanola":
|
||||||
|
return CommonConfig.Worldgen.GENERATE_CANOLA.get();
|
||||||
|
case "generateFlax":
|
||||||
|
return CommonConfig.Worldgen.GENERATE_FLAX.get();
|
||||||
|
case "generateCoffee":
|
||||||
|
return CommonConfig.Worldgen.GENERATE_COFFEE.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue