mirror of
https://github.com/TeamMidnightDust/ThisRocks.git
synced 2025-12-17 19:35:10 +01:00
This Rocks 1.5.0 - Crimson & Warped Sticks, Config, Compat
- Added Crimson and Warped sticks that generate in nether forests - Add config to disable spawning of each block - Migrate to Fabric Biome API (results in better compatibility with biome datapacks) - Optimize assets by @RDKRACZ
This commit is contained in:
@@ -7,8 +7,8 @@ import net.minecraft.util.Identifier;
|
||||
public class RocksClient implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("red"), (stack, world, entity, seed) -> (stack.getTag() != null && stack.getTag().getString("variation").equals("red")) ? 1 : 0);
|
||||
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("pink"), (stack, world, entity, seed) -> (stack.getTag() != null && stack.getTag().getString("variation").equals("pink")) ? 1 : 0);
|
||||
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("orange"), (stack, world, entity, seed) -> (stack.getTag() != null && stack.getTag().getString("variation").equals("orange")) ? 1 : 0);
|
||||
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("red"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("red")) ? 1 : 0);
|
||||
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("pink"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("pink")) ? 1 : 0);
|
||||
FabricModelPredicateProviderRegistry.register(RocksMain.Starfish.asItem(), new Identifier("orange"), (stack, world, entity, seed) -> (stack.getNbt() != null && stack.getNbt().getString("variation").equals("orange")) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import eu.midnightdust.motschen.rocks.blockstates.RockVariation;
|
||||
import eu.midnightdust.motschen.rocks.blockstates.SeashellVariation;
|
||||
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
|
||||
import eu.midnightdust.motschen.rocks.blockstates.StickVariation;
|
||||
import eu.midnightdust.motschen.rocks.config.RocksConfig;
|
||||
import eu.midnightdust.motschen.rocks.world.*;
|
||||
import eu.midnightdust.motschen.rocks.world.configured_feature.MiscFeatures;
|
||||
import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures;
|
||||
@@ -20,9 +21,7 @@ import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class RocksMain implements ModInitializer {
|
||||
|
||||
public static final String MOD_ID = "rocks";
|
||||
|
||||
public static final ItemGroup RocksGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "rocks"), () -> new ItemStack(RocksMain.Rock));
|
||||
|
||||
public static final EnumProperty<RockVariation> ROCK_VARIATION = EnumProperty.of("variation", RockVariation.class);
|
||||
@@ -47,6 +46,8 @@ public class RocksMain implements ModInitializer {
|
||||
public static Block AcaciaStick = new Stick();
|
||||
public static Block JungleStick = new Stick();
|
||||
public static Block DarkOakStick = new Stick();
|
||||
public static Block CrimsonStick = new Stick();
|
||||
public static Block WarpedStick = new Stick();
|
||||
|
||||
public static Block Pinecone = new Pinecone();
|
||||
public static Block Seashell = new Seashell();
|
||||
@@ -66,6 +67,8 @@ public class RocksMain implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
RocksConfig.init("rocks", RocksConfig.class);
|
||||
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"rock"), Rock);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"rock"), new BlockItem(Rock, new Item.Settings().group(RocksMain.RocksGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"granite_rock"), GraniteRock);
|
||||
@@ -99,6 +102,10 @@ public class RocksMain implements ModInitializer {
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"jungle_stick"), new BlockItem(JungleStick, new Item.Settings().group(RocksMain.RocksGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"dark_oak_stick"), DarkOakStick);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"dark_oak_stick"), new BlockItem(DarkOakStick, new Item.Settings().group(RocksMain.RocksGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"crimson_stick"), CrimsonStick);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"crimson_stick"), new BlockItem(CrimsonStick, new Item.Settings().group(RocksMain.RocksGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"warped_stick"), WarpedStick);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"warped_stick"), new BlockItem(WarpedStick, new Item.Settings().group(RocksMain.RocksGroup)));
|
||||
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"geyser"), Geyser);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"geyser"), new BlockItem(Geyser, new Item.Settings().group(RocksMain.RocksGroup)));
|
||||
|
||||
@@ -50,8 +50,8 @@ public class Starfish extends Block implements Waterloggable {
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
ItemStack stack = itemPlacementContext.getStack();
|
||||
StarfishVariation variation = StarfishVariation.RED;
|
||||
if (stack.getTag() != null) {
|
||||
var optionalVariation = STARFISH_VARIATION.parse(stack.getTag().getString("variation"));
|
||||
if (stack.getNbt() != null) {
|
||||
var optionalVariation = STARFISH_VARIATION.parse(stack.getNbt().getString("variation"));
|
||||
if (optionalVariation.isPresent()) variation = optionalVariation.get();
|
||||
}
|
||||
FluidState fluidState = itemPlacementContext.getWorld().getFluidState(itemPlacementContext.getBlockPos());
|
||||
@@ -61,7 +61,7 @@ public class Starfish extends Block implements Waterloggable {
|
||||
@Override
|
||||
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
stack.getOrCreateTag().putString("variation", state.get(STARFISH_VARIATION).asString());
|
||||
stack.getNbt().putString("variation", state.get(STARFISH_VARIATION).asString());
|
||||
LOGGER.info(state.get(STARFISH_VARIATION).asString());
|
||||
return stack;
|
||||
}
|
||||
|
||||
38
src/main/java/eu/midnightdust/motschen/rocks/config/RocksConfig.java
Executable file
38
src/main/java/eu/midnightdust/motschen/rocks/config/RocksConfig.java
Executable file
@@ -0,0 +1,38 @@
|
||||
package eu.midnightdust.motschen.rocks.config;
|
||||
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
public class RocksConfig extends MidnightConfig {
|
||||
@Comment public static Comment needs_restart;
|
||||
|
||||
@Comment public static Comment rocks;
|
||||
@Entry(name = "block.rocks.rock") public static boolean rock = true;
|
||||
@Entry(name = "block.rocks.granite_rock") public static boolean granite_rock = true;
|
||||
@Entry(name = "block.rocks.diorite_rock") public static boolean diorite_rock = true;
|
||||
@Entry(name = "block.rocks.andesite_rock") public static boolean andesite_rock = true;
|
||||
@Entry(name = "block.rocks.sand_rock") public static boolean sand_rock = true;
|
||||
@Entry(name = "block.rocks.red_sand_rock") public static boolean red_sand_rock = true;
|
||||
@Entry(name = "block.rocks.gravel_rock") public static boolean gravel_rock = true;
|
||||
@Entry(name = "block.rocks.end_stone_rock") public static boolean end_stone_rock = true;
|
||||
@Entry(name = "block.rocks.netherrack_rock") public static boolean netherrack_rock = true;
|
||||
@Entry(name = "block.rocks.soul_soil_rock") public static boolean soul_soil_rock = true;
|
||||
|
||||
@Comment public static Comment sticks;
|
||||
@Entry(name = "block.rocks.oak_stick") public static boolean oak_stick = true;
|
||||
@Entry(name = "block.rocks.spruce_stick") public static boolean spruce_stick = true;
|
||||
@Entry(name = "block.rocks.birch_stick") public static boolean birch_stick = true;
|
||||
@Entry(name = "block.rocks.acacia_stick") public static boolean acacia_stick = true;
|
||||
@Entry(name = "block.rocks.jungle_stick") public static boolean jungle_stick = true;
|
||||
@Entry(name = "block.rocks.dark_oak_stick") public static boolean dark_oak_stick = true;
|
||||
@Entry(name = "block.rocks.crimson_stick") public static boolean crimson_stick = true;
|
||||
@Entry(name = "block.rocks.warped_stick") public static boolean warped_stick = true;
|
||||
|
||||
@Comment public static Comment misc;
|
||||
@Entry(name = "block.rocks.pinecone") public static boolean pinecone = true;
|
||||
@Entry(name = "block.rocks.geyser") public static boolean geyser = true;
|
||||
@Entry(name = "block.rocks.nether_geyser") public static boolean nether_geyser = true;
|
||||
@Entry(name = "block.rocks.seashell") public static boolean seashell = true;
|
||||
@Entry(name = "block.rocks.starfish") public static boolean starfish = true;
|
||||
@Entry public static boolean underwater_seashell = true;
|
||||
@Entry public static boolean underwater_starfish = true;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package eu.midnightdust.motschen.rocks.mixin;
|
||||
|
||||
import net.minecraft.world.biome.GenerationSettings;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(GenerationSettings.class)
|
||||
public interface GenerationSettingsAccessorMixin {
|
||||
|
||||
@Accessor
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
|
||||
|
||||
@Accessor
|
||||
void setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
|
||||
}
|
||||
@@ -1,102 +1,96 @@
|
||||
package eu.midnightdust.motschen.rocks.world;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.midnightdust.motschen.rocks.mixin.GenerationSettingsAccessorMixin;
|
||||
import eu.midnightdust.motschen.rocks.config.RocksConfig;
|
||||
import eu.midnightdust.motschen.rocks.world.configured_feature.MiscFeatures;
|
||||
import eu.midnightdust.motschen.rocks.world.configured_feature.NetherFeatures;
|
||||
import eu.midnightdust.motschen.rocks.world.configured_feature.RockFeatures;
|
||||
import eu.midnightdust.motschen.rocks.world.configured_feature.StickFeatures;
|
||||
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@SuppressWarnings({"deprecation", "OptionalGetWithoutIsPresent"})
|
||||
public class FeatureInjector {
|
||||
|
||||
public static void init() {
|
||||
BuiltinRegistries.BIOME.forEach(FeatureInjector::addRockToBiome);
|
||||
RegistryEntryAddedCallback.event(BuiltinRegistries.BIOME).register((i, identifier, biome) -> addRockToBiome(biome));
|
||||
}
|
||||
|
||||
private static void addRockToBiome(Biome biome) {
|
||||
// Rocks
|
||||
if (biome.getCategory() != Biome.Category.NETHER && biome.getCategory() != Biome.Category.THEEND && biome.getCategory() != Biome.Category.BEACH && biome.getCategory() != Biome.Category.DESERT && biome.getCategory() != Biome.Category.MESA && biome.getCategory() != Biome.Category.ICY && biome.getCategory() != Biome.Category.OCEAN) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ROCK_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRANITE_ROCK_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.DIORITE_ROCK_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.ANDESITE_ROCK_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.BEACH || biome.getCategory() == Biome.Category.DESERT || biome.getCategory() == Biome.Category.MESA || biome.toString().contains("terrestria:lush_desert")) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.SAND_ROCK_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.MESA || biome.getCategory() == Biome.Category.DESERT || biome.toString().contains("terrestria:lush_desert")) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.RED_SAND_ROCK_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.THEEND) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.END_STONE_ROCK_FEATURE);
|
||||
}
|
||||
// Sticks
|
||||
if (biome.toString().contains("minecraft:forest") || biome.toString().contains("minecraft:wooded_hills") ||
|
||||
biome.toString().contains("minecraft:wooded_mountains") || biome.toString().contains("minecraft:plains") ||
|
||||
biome.toString().contains("minecraft:flower_forest") || biome.toString().contains("minecraft:wooded_badlands_plateau") ||
|
||||
biome.toString().contains("minecraft:modified_wooded_badlands_plateau") || biome.getCategory() == Biome.Category.SWAMP) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.OAK_STICK_FEATURE);
|
||||
}
|
||||
if (biome.toString().contains("minecraft:forest") || biome.toString().contains("minecraft:birch_forest") ||
|
||||
biome.toString().contains("minecraft:birch_forest_hills") || biome.toString().contains("minecraft:flower_forest")) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.BIRCH_STICK_FEATURE);
|
||||
}
|
||||
if (biome.toString().contains("minecraft:wooded_mountains") || biome.getCategory() == Biome.Category.TAIGA) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.SPRUCE_STICK_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.SAVANNA) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.ACACIA_STICK_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.JUNGLE) {
|
||||
addRockFeature(biome, GenerationStep.Feature.UNDERGROUND_DECORATION, StickFeatures.JUNGLE_STICK_FEATURE);
|
||||
}
|
||||
if (biome.toString().contains("minecraft:dark_forest") || biome.toString().contains("minecraft:dark_forest_hills") ||
|
||||
biome.toString().contains("minecraft:dark_forest_mountains")) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, StickFeatures.DARK_OAK_STICK_FEATURE);
|
||||
}
|
||||
// Misc
|
||||
if (biome.getCategory() == Biome.Category.BEACH && !biome.toString().contains("minecraft:snowy_beach")) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SEASHELL_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.STARFISH_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.OCEAN) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_STARFISH_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.UNDERWATER_SEASHELL_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.NETHER) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHERRACK_ROCK_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.SOUL_SOIL_ROCK_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GRAVEL_ROCK_FEATURE);
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, NetherFeatures.NETHER_GEYSER_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() != Biome.Category.NETHER) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, RockFeatures.GRAVEL_ROCK_FEATURE);
|
||||
}
|
||||
if (biome.getCategory() == Biome.Category.ICY) {
|
||||
addRockFeature(biome, GenerationStep.Feature.TOP_LAYER_MODIFICATION, MiscFeatures.SNOWY_GEYSER_FEATURE);
|
||||
}
|
||||
}
|
||||
Predicate<BiomeSelectionContext> rocks = (ctx -> {
|
||||
Biome.Category cat = ctx.getBiome().getCategory();
|
||||
return cat != Biome.Category.NETHER && cat != Biome.Category.THEEND && cat!= Biome.Category.BEACH && cat != Biome.Category.DESERT
|
||||
&& cat != Biome.Category.MESA && cat != Biome.Category.ICY && cat != Biome.Category.OCEAN ;});
|
||||
if (RocksConfig.rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.ROCK_FEATURE).get());
|
||||
if (RocksConfig.granite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.GRANITE_ROCK_FEATURE).get());
|
||||
if (RocksConfig.diorite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.DIORITE_ROCK_FEATURE).get());
|
||||
if (RocksConfig.andesite_rock) BiomeModifications.addFeature(rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.ANDESITE_ROCK_FEATURE).get());
|
||||
|
||||
public static void addRockFeature(Biome biome, GenerationStep.Feature step, ConfiguredFeature<?, ?> feature) {
|
||||
GenerationSettingsAccessorMixin generationSettingsAccessor = (GenerationSettingsAccessorMixin) biome.getGenerationSettings();
|
||||
int stepIndex = step.ordinal();
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>( generationSettingsAccessor.getFeatures());
|
||||
while (featuresByStep.size() <= stepIndex) {
|
||||
featuresByStep.add(Lists.newArrayList());
|
||||
}
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(featuresByStep.get(stepIndex));
|
||||
features.add(() -> feature);
|
||||
featuresByStep.set(stepIndex, features);
|
||||
generationSettingsAccessor.setFeatures(featuresByStep);
|
||||
Predicate<BiomeSelectionContext> sand_rocks = (ctx -> {
|
||||
Biome.Category cat = ctx.getBiome().getCategory();
|
||||
return cat == Biome.Category.BEACH || cat == Biome.Category.DESERT || cat == Biome.Category.MESA || ctx.getBiomeKey().getValue().toString().contains("terrestria:lush_desert");
|
||||
});
|
||||
if (RocksConfig.sand_rock) BiomeModifications.addFeature(sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.SAND_ROCK_FEATURE).get());
|
||||
|
||||
Predicate<BiomeSelectionContext> red_sand_rocks = (ctx -> {
|
||||
Biome.Category cat = ctx.getBiome().getCategory();
|
||||
return cat == Biome.Category.MESA || cat == Biome.Category.DESERT || ctx.getBiomeKey().getValue().toString().contains("terrestria:lush_desert");
|
||||
});
|
||||
if (RocksConfig.red_sand_rock) BiomeModifications.addFeature(red_sand_rocks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.RED_SAND_ROCK_FEATURE).get());
|
||||
|
||||
if (RocksConfig.end_stone_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.THEEND, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.END_STONE_ROCK_FEATURE).get());
|
||||
|
||||
// Sticks
|
||||
Predicate<BiomeSelectionContext> oak_sticks = (ctx -> {
|
||||
String name = ctx.getBiomeKey().getValue().toString();
|
||||
Biome.Category cat = ctx.getBiome().getCategory();
|
||||
return name.contains("minecraft:forest") || name.contains("minecraft:wooded_hills") || name.contains("oak") ||
|
||||
name.contains("minecraft:wooded_mountains") || name.contains("minecraft:plains") ||
|
||||
name.contains("minecraft:flower_forest") || name.contains("minecraft:wooded_badlands_plateau") ||
|
||||
name.contains("minecraft:modified_wooded_badlands_plateau") || cat == Biome.Category.SWAMP;});
|
||||
if (RocksConfig.oak_stick) BiomeModifications.addFeature(oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.OAK_STICK_FEATURE).get());
|
||||
|
||||
Predicate<BiomeSelectionContext> birch_sticks = (ctx -> {
|
||||
String name = ctx.getBiomeKey().getValue().toString();
|
||||
return name.contains("minecraft:forest") || name.contains("birch") || name.contains("minecraft:flower_forest");});
|
||||
if (RocksConfig.birch_stick) BiomeModifications.addFeature(birch_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.BIRCH_STICK_FEATURE).get());
|
||||
|
||||
Predicate<BiomeSelectionContext> spruce_sticks = (ctx -> {
|
||||
String name = ctx.getBiomeKey().getValue().toString();
|
||||
Biome.Category cat = ctx.getBiome().getCategory();
|
||||
return name.contains("minecraft:wooded_mountains") || cat == Biome.Category.TAIGA;});
|
||||
if (RocksConfig.spruce_stick) BiomeModifications.addFeature(spruce_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.SPRUCE_STICK_FEATURE).get());
|
||||
|
||||
if (RocksConfig.acacia_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.SAVANNA, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.ACACIA_STICK_FEATURE).get());
|
||||
|
||||
if (RocksConfig.jungle_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.JUNGLE, GenerationStep.Feature.UNDERGROUND_DECORATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.JUNGLE_STICK_FEATURE).get());
|
||||
|
||||
Predicate<BiomeSelectionContext> dark_oak_sticks = (ctx -> {
|
||||
String name = ctx.getBiomeKey().getValue().toString();
|
||||
return name.contains("minecraft:dark_forest") || name.contains("minecraft:dark_forest_hills") ||
|
||||
name.contains("minecraft:dark_forest_mountains");});
|
||||
if (RocksConfig.dark_oak_stick) BiomeModifications.addFeature(dark_oak_sticks, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(StickFeatures.DARK_OAK_STICK_FEATURE).get());
|
||||
|
||||
// Misc
|
||||
Predicate<BiomeSelectionContext> beach = (ctx -> {
|
||||
String name = ctx.getBiomeKey().getValue().toString();
|
||||
Biome.Category cat = ctx.getBiome().getCategory();
|
||||
return cat == Biome.Category.BEACH && !name.contains("snow");});
|
||||
if (RocksConfig.seashell) BiomeModifications.addFeature(beach, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.SEASHELL_FEATURE).get());
|
||||
if (RocksConfig.starfish) BiomeModifications.addFeature(beach, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.STARFISH_FEATURE).get());
|
||||
|
||||
if (RocksConfig.underwater_starfish) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.OCEAN, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.UNDERWATER_STARFISH_FEATURE).get());
|
||||
if (RocksConfig.underwater_seashell) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.OCEAN, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.UNDERWATER_SEASHELL_FEATURE).get());
|
||||
|
||||
if (RocksConfig.netherrack_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.NETHERRACK_ROCK_FEATURE).get());
|
||||
if (RocksConfig.soul_soil_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.SOUL_SOIL_ROCK_FEATURE).get());
|
||||
if (RocksConfig.gravel_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.NETHER_GRAVEL_ROCK_FEATURE).get());
|
||||
if (RocksConfig.nether_geyser) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.NETHER_GEYSER_FEATURE).get());
|
||||
if (RocksConfig.warped_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.WARPED_STICK_FEATURE).get());
|
||||
if (RocksConfig.crimson_stick) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(NetherFeatures.CRIMSON_STICK_FEATURE).get());
|
||||
|
||||
if (RocksConfig.gravel_rock) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() != Biome.Category.NETHER, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(RockFeatures.GRAVEL_ROCK_FEATURE).get());
|
||||
|
||||
if (RocksConfig.geyser) BiomeModifications.addFeature(ctx -> ctx.getBiome().getCategory() == Biome.Category.ICY, GenerationStep.Feature.TOP_LAYER_MODIFICATION, BuiltinRegistries.CONFIGURED_FEATURE.getKey(MiscFeatures.SNOWY_GEYSER_FEATURE).get());
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package eu.midnightdust.motschen.rocks.world.configured_feature;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import eu.midnightdust.motschen.rocks.RocksMain;
|
||||
import eu.midnightdust.motschen.rocks.blockstates.RockVariation;
|
||||
import eu.midnightdust.motschen.rocks.blockstates.StickVariation;
|
||||
import eu.midnightdust.motschen.rocks.world.RocksDecorators;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -56,6 +57,25 @@ public class NetherFeatures {
|
||||
.tries(1).spreadX(0).spreadY(0).spreadZ(0)
|
||||
.whitelist(ImmutableSet.of(Blocks.NETHERRACK)).cannotProject().build())).decorate(RocksDecorators.ROCK).repeat(16);
|
||||
|
||||
public static ConfiguredFeature<?, ?> WARPED_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
|
||||
(new RandomPatchFeatureConfig.Builder(
|
||||
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
|
||||
.add(RocksMain.WarpedStick.getDefaultState().with(RocksMain.STICK_VARIATION, StickVariation.SMALL), 7)
|
||||
.add(RocksMain.WarpedStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
|
||||
.add(RocksMain.WarpedStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
|
||||
SimpleBlockPlacer.INSTANCE))
|
||||
.tries(1).spreadX(0).spreadY(0).spreadZ(0)
|
||||
.whitelist(ImmutableSet.of(Blocks.WARPED_NYLIUM)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
|
||||
public static ConfiguredFeature<?, ?> CRIMSON_STICK_FEATURE = Feature.RANDOM_PATCH.configure(
|
||||
(new RandomPatchFeatureConfig.Builder(
|
||||
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
|
||||
.add(RocksMain.CrimsonStick.getDefaultState().with(RocksMain.STICK_VARIATION, StickVariation.SMALL), 7)
|
||||
.add(RocksMain.CrimsonStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.MEDIUM), 5)
|
||||
.add(RocksMain.CrimsonStick.getDefaultState().with(RocksMain.STICK_VARIATION,StickVariation.LARGE), 1).build()),
|
||||
SimpleBlockPlacer.INSTANCE))
|
||||
.tries(1).spreadX(0).spreadY(0).spreadZ(0)
|
||||
.whitelist(ImmutableSet.of(Blocks.CRIMSON_NYLIUM)).cannotProject().build()).decorate(RocksDecorators.ROCK).repeat(128);
|
||||
|
||||
public static void init() {
|
||||
Registry<ConfiguredFeature<?, ?>> registry = BuiltinRegistries.CONFIGURED_FEATURE;
|
||||
|
||||
@@ -63,6 +83,9 @@ public class NetherFeatures {
|
||||
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "soul_soil_rock"), SOUL_SOIL_ROCK_FEATURE);
|
||||
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "nether_gravel_rock"), NETHER_GRAVEL_ROCK_FEATURE);
|
||||
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "nether_geyser"), NETHER_GEYSER_FEATURE);
|
||||
|
||||
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "warped_stick"), WARPED_STICK_FEATURE);
|
||||
Registry.register(registry, new Identifier(RocksMain.MOD_ID, "crimson_stick"), CRIMSON_STICK_FEATURE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package eu.midnightdust.motschen.rocks.world.configured_feature;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import eu.midnightdust.motschen.rocks.RocksMain;
|
||||
import eu.midnightdust.motschen.rocks.blockstates.RockVariation;
|
||||
import eu.midnightdust.motschen.rocks.config.RocksConfig;
|
||||
import eu.midnightdust.motschen.rocks.world.RocksDecorators;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
||||
Reference in New Issue
Block a user