diff --git a/build.gradle b/build.gradle index ea2bff4..206712c 100755 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,9 @@ minecraft { repositories { maven { url "https://maven.terraformersmc.com/releases" } maven { url "https://jitpack.io" } + flatDir { + dirs 'local_maven' + } } dependencies { @@ -28,8 +31,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation "com.github.TeamMidnightDust:MidnightLib:${midnightlib_version}" - include "com.github.TeamMidnightDust:MidnightLib:${midnightlib_version}" + modImplementation "eu.midnightdust:midnightlib:${midnightlib_version}" + include "eu.midnightdust:midnightlib:${midnightlib_version}" } processResources { diff --git a/gradle.properties b/gradle.properties index 057f32a..4987514 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.17-pre1 - yarn_mappings=1.17-pre1+build.9 - loader_version=0.11.3 + minecraft_version=1.17.1 + yarn_mappings=1.17.1+build.61 + loader_version=0.11.7 # Mod Properties - mod_version = 1.4.0 + mod_version = 1.5.0 maven_group = eu.midnightdust.motschen archives_base_name = rocks # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.34.8+1.17 - midnightlib_version=v0.2.2 + fabric_version=0.40.1+1.17 + midnightlib_version=0.2.5 diff --git a/local_maven/midnightlib-0.2.5.jar b/local_maven/midnightlib-0.2.5.jar new file mode 100755 index 0000000..c18424c Binary files /dev/null and b/local_maven/midnightlib-0.2.5.jar differ diff --git a/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java b/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java index 081b87d..451b796 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/RocksClient.java @@ -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); } } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java b/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java index 23e6665..a13863f 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/RocksMain.java @@ -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 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))); diff --git a/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java b/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java index f69b318..1e79a8d 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/block/Starfish.java @@ -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; } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/config/RocksConfig.java b/src/main/java/eu/midnightdust/motschen/rocks/config/RocksConfig.java new file mode 100755 index 0000000..7b18083 --- /dev/null +++ b/src/main/java/eu/midnightdust/motschen/rocks/config/RocksConfig.java @@ -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; +} diff --git a/src/main/java/eu/midnightdust/motschen/rocks/mixin/GenerationSettingsAccessorMixin.java b/src/main/java/eu/midnightdust/motschen/rocks/mixin/GenerationSettingsAccessorMixin.java deleted file mode 100755 index f20c713..0000000 --- a/src/main/java/eu/midnightdust/motschen/rocks/mixin/GenerationSettingsAccessorMixin.java +++ /dev/null @@ -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>>> getFeatures(); - - @Accessor - void setFeatures(List>>> features); -} diff --git a/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java b/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java index 35f1fd4..928474f 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/world/FeatureInjector.java @@ -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 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>>> featuresByStep = new ArrayList<>( generationSettingsAccessor.getFeatures()); - while (featuresByStep.size() <= stepIndex) { - featuresByStep.add(Lists.newArrayList()); - } - List>> features = new ArrayList<>(featuresByStep.get(stepIndex)); - features.add(() -> feature); - featuresByStep.set(stepIndex, features); - generationSettingsAccessor.setFeatures(featuresByStep); + Predicate 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 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 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 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 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 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 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()); } } \ No newline at end of file diff --git a/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/NetherFeatures.java b/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/NetherFeatures.java index 5d516ff..d08e47e 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/NetherFeatures.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/NetherFeatures.java @@ -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.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.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> 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); } } diff --git a/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/RockFeatures.java b/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/RockFeatures.java index 8e862bc..93d6a31 100755 --- a/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/RockFeatures.java +++ b/src/main/java/eu/midnightdust/motschen/rocks/world/configured_feature/RockFeatures.java @@ -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; diff --git a/src/main/resources/assets/rocks/blockstates/crimson_stick.json b/src/main/resources/assets/rocks/blockstates/crimson_stick.json new file mode 100755 index 0000000..efc43c6 --- /dev/null +++ b/src/main/resources/assets/rocks/blockstates/crimson_stick.json @@ -0,0 +1,22 @@ +{ + "variants": { + "variation=small": [ + {"model": "rocks:block/small_crimson_stick"}, + {"model": "rocks:block/small_crimson_stick", "y": 90}, + {"model": "rocks:block/small_crimson_stick", "y": 180}, + {"model": "rocks:block/small_crimson_stick", "y": 270} + ], + "variation=medium": [ + {"model": "rocks:block/medium_crimson_stick"}, + {"model": "rocks:block/medium_crimson_stick", "y": 90}, + {"model": "rocks:block/medium_crimson_stick", "y": 180}, + {"model": "rocks:block/medium_crimson_stick", "y": 270} + ], + "variation=large": [ + {"model": "rocks:block/large_crimson_stick"}, + {"model": "rocks:block/large_crimson_stick", "y": 90}, + {"model": "rocks:block/large_crimson_stick", "y": 180}, + {"model": "rocks:block/large_crimson_stick", "y": 270} + ] + } +} diff --git a/src/main/resources/assets/rocks/blockstates/warped_stick.json b/src/main/resources/assets/rocks/blockstates/warped_stick.json new file mode 100755 index 0000000..26469ff --- /dev/null +++ b/src/main/resources/assets/rocks/blockstates/warped_stick.json @@ -0,0 +1,22 @@ +{ + "variants": { + "variation=small": [ + {"model": "rocks:block/small_warped_stick"}, + {"model": "rocks:block/small_warped_stick", "y": 90}, + {"model": "rocks:block/small_warped_stick", "y": 180}, + {"model": "rocks:block/small_warped_stick", "y": 270} + ], + "variation=medium": [ + {"model": "rocks:block/medium_warped_stick"}, + {"model": "rocks:block/medium_warped_stick", "y": 90}, + {"model": "rocks:block/medium_warped_stick", "y": 180}, + {"model": "rocks:block/medium_warped_stick", "y": 270} + ], + "variation=large": [ + {"model": "rocks:block/large_warped_stick"}, + {"model": "rocks:block/large_warped_stick", "y": 90}, + {"model": "rocks:block/large_warped_stick", "y": 180}, + {"model": "rocks:block/large_warped_stick", "y": 270} + ] + } +} diff --git a/src/main/resources/assets/rocks/lang/de_de.json b/src/main/resources/assets/rocks/lang/de_de.json index 5c8b172..9883967 100755 --- a/src/main/resources/assets/rocks/lang/de_de.json +++ b/src/main/resources/assets/rocks/lang/de_de.json @@ -18,6 +18,8 @@ "block.rocks.jungle_stick":"Tropenholzstock", "block.rocks.acacia_stick":"Akazienholzstock", "block.rocks.dark_oak_stick":"Schwarzeichenholzstock", + "block.rocks.crimson_stick":"Karmesinstock", + "block.rocks.warped_stick":"Wirrstock", "block.rocks.geyser":"Geyser", "block.rocks.nether_geyser":"Magma Geyser", @@ -34,5 +36,13 @@ "item.rocks.red_sandstone_splitter":"Roter Sandsteinsplitter", "item.rocks.end_stone_splitter":"Endsteinsplitter", "item.rocks.netherrack_splitter":"Netherracksplitter", - "item.rocks.soul_soil_splitter":"Seelenerdesplitter" + "item.rocks.soul_soil_splitter":"Seelenerdesplitter", + + "rocks.midnightconfig.title": "This Rocks! Konfiguration", + "rocks.midnightconfig.needs_restart": "§c Starte das Spiel neu, nachdem du Änderungen vorgenommen hast!", + "rocks.midnightconfig.rocks": "§aBrocken", + "rocks.midnightconfig.sticks": "§aStöcke", + "rocks.midnightconfig.misc": "§aWeiteres", + "rocks.midnightconfig.underwater_seashell": "Unterwassermuschel", + "rocks.midnightconfig.underwater_starfish": "Unterwasserseestern" } \ No newline at end of file diff --git a/src/main/resources/assets/rocks/lang/en_us.json b/src/main/resources/assets/rocks/lang/en_us.json index 483c78f..983157b 100755 --- a/src/main/resources/assets/rocks/lang/en_us.json +++ b/src/main/resources/assets/rocks/lang/en_us.json @@ -18,6 +18,8 @@ "block.rocks.jungle_stick":"Jungle Stick", "block.rocks.acacia_stick":"Acacia Stick", "block.rocks.dark_oak_stick":"Dark Oak Stick", + "block.rocks.crimson_stick":"Crimson Stick", + "block.rocks.warped_stick":"Warped Stick", "block.rocks.geyser":"Geyser", "block.rocks.nether_geyser":"Magma Geyser", @@ -34,5 +36,13 @@ "item.rocks.red_sandstone_splitter":"Red Sandstone Splitter", "item.rocks.end_stone_splitter":"End Stone Splitter", "item.rocks.netherrack_splitter":"Netherrack Splitter", - "item.rocks.soul_soil_splitter":"Soul Soil Splitter" + "item.rocks.soul_soil_splitter":"Soul Soil Splitter", + + "rocks.midnightconfig.title":"This Rocks! Config", + "rocks.midnightconfig.needs_restart":"§c Restart game after changing config!", + "rocks.midnightconfig.rocks":"§aRocks", + "rocks.midnightconfig.sticks":"§aSticks", + "rocks.midnightconfig.misc":"§aMiscellaneous", + "rocks.midnightconfig.underwater_seashell":"Underwater Seashell", + "rocks.midnightconfig.underwater_starfish":"Underwater Starfish" } \ No newline at end of file diff --git a/src/main/resources/assets/rocks/models/block/large_crimson_stick.json b/src/main/resources/assets/rocks/models/block/large_crimson_stick.json new file mode 100755 index 0000000..5406b50 --- /dev/null +++ b/src/main/resources/assets/rocks/models/block/large_crimson_stick.json @@ -0,0 +1,7 @@ +{ + "parent": "rocks:block/large_oak_stick", + "textures": { + "0": "block/crimson_stem", + "particle": "block/crimson_stem" + } +} diff --git a/src/main/resources/assets/rocks/models/block/large_warped_stick.json b/src/main/resources/assets/rocks/models/block/large_warped_stick.json new file mode 100755 index 0000000..bc6672a --- /dev/null +++ b/src/main/resources/assets/rocks/models/block/large_warped_stick.json @@ -0,0 +1,7 @@ +{ + "parent": "rocks:block/large_oak_stick", + "textures": { + "0": "block/warped_stem", + "particle": "block/warped_stem" + } +} diff --git a/src/main/resources/assets/rocks/models/block/medium_crimson_stick.json b/src/main/resources/assets/rocks/models/block/medium_crimson_stick.json new file mode 100755 index 0000000..43ec76a --- /dev/null +++ b/src/main/resources/assets/rocks/models/block/medium_crimson_stick.json @@ -0,0 +1,7 @@ +{ + "parent": "rocks:block/medium_oak_stick", + "textures": { + "0": "block/crimson_stem", + "particle": "block/crimson_stem" + } +} diff --git a/src/main/resources/assets/rocks/models/block/medium_warped_stick.json b/src/main/resources/assets/rocks/models/block/medium_warped_stick.json new file mode 100755 index 0000000..36df041 --- /dev/null +++ b/src/main/resources/assets/rocks/models/block/medium_warped_stick.json @@ -0,0 +1,7 @@ +{ + "parent": "rocks:block/medium_oak_stick", + "textures": { + "0": "block/warped_stem", + "particle": "block/warped_stem" + } +} diff --git a/src/main/resources/assets/rocks/models/block/small_crimson_stick.json b/src/main/resources/assets/rocks/models/block/small_crimson_stick.json new file mode 100755 index 0000000..422d9a2 --- /dev/null +++ b/src/main/resources/assets/rocks/models/block/small_crimson_stick.json @@ -0,0 +1,7 @@ +{ + "parent": "rocks:block/small_oak_stick", + "textures": { + "0": "block/crimson_stem", + "particle": "block/crimson_stem" + } +} diff --git a/src/main/resources/assets/rocks/models/block/small_warped_stick.json b/src/main/resources/assets/rocks/models/block/small_warped_stick.json new file mode 100755 index 0000000..4361a72 --- /dev/null +++ b/src/main/resources/assets/rocks/models/block/small_warped_stick.json @@ -0,0 +1,7 @@ +{ + "parent": "rocks:block/small_oak_stick", + "textures": { + "0": "block/warped_stem", + "particle": "block/warped_stem" + } +} diff --git a/src/main/resources/assets/rocks/models/item/crimson_stick.json b/src/main/resources/assets/rocks/models/item/crimson_stick.json new file mode 100755 index 0000000..9a73972 --- /dev/null +++ b/src/main/resources/assets/rocks/models/item/crimson_stick.json @@ -0,0 +1,3 @@ +{ + "parent": "rocks:block/large_crimson_stick" +} diff --git a/src/main/resources/assets/rocks/models/item/warped_stick.json b/src/main/resources/assets/rocks/models/item/warped_stick.json new file mode 100755 index 0000000..910fb59 --- /dev/null +++ b/src/main/resources/assets/rocks/models/item/warped_stick.json @@ -0,0 +1,3 @@ +{ + "parent": "rocks:block/large_warped_stick" +} diff --git a/src/main/resources/data/rocks/loot_tables/blocks/crimson_stick.json b/src/main/resources/data/rocks/loot_tables/blocks/crimson_stick.json new file mode 100755 index 0000000..bbd852e --- /dev/null +++ b/src/main/resources/data/rocks/loot_tables/blocks/crimson_stick.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rocks/loot_tables/blocks/warped_stick.json b/src/main/resources/data/rocks/loot_tables/blocks/warped_stick.json new file mode 100755 index 0000000..bbd852e --- /dev/null +++ b/src/main/resources/data/rocks/loot_tables/blocks/warped_stick.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/rocks.mixins.json b/src/main/resources/rocks.mixins.json index 603ddda..c652810 100755 --- a/src/main/resources/rocks.mixins.json +++ b/src/main/resources/rocks.mixins.json @@ -2,9 +2,6 @@ "required": true, "package": "eu.midnightdust.motschen.rocks.mixin", "compatibilityLevel": "JAVA_8", - "mixins": [ - "GenerationSettingsAccessorMixin" - ], "client": [ "MixinModelElementDeserializer" ],