diff --git a/fabric/gradle.properties b/fabric/gradle.properties index 2127595..619d321 100644 --- a/fabric/gradle.properties +++ b/fabric/gradle.properties @@ -4,15 +4,15 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.5 -yarn_mappings=1.20.5+build.1 -loader_version=0.15.10 +minecraft_version=1.21 +yarn_mappings=1.21+build.1 +loader_version=0.15.11 -#Fabric api -fabric_version=0.97.6+1.20.5 +# Fabric API +fabric_version=0.100.1+1.21 # Mod Properties -mod_version=2.2.0 +mod_version=2.3.0 maven_group=eu.annsann archives_base_name=flower_power modid=flower_power \ No newline at end of file diff --git a/fabric/remappedSrc/eu/annsann/flowerpower/FlowerPower.java b/fabric/remappedSrc/eu/annsann/flowerpower/FlowerPower.java new file mode 100644 index 0000000..f744cf7 --- /dev/null +++ b/fabric/remappedSrc/eu/annsann/flowerpower/FlowerPower.java @@ -0,0 +1,48 @@ +package eu.annsann.flowerpower; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.minecraft.block.*; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +import java.util.Arrays; + +import static eu.annsann.flowerpower.Flowers.*; + +public class FlowerPower implements ModInitializer { + public static final String MOD_NAME = "flower_power"; + public static final RegistryKey ITEM_GROUP = RegistryKey.of( + RegistryKeys.ITEM_GROUP, + new Identifier(MOD_NAME, MOD_NAME + "_group") + ); + + /** + * Runs the mod initializer. + */ + @Override + public void onInitialize() { + GenericPetalHelper.registerPetal("red_petals", RED_PETALS); + GenericPetalHelper.registerPetal("yellow_petals", YELLOW_PETALS); + GenericPetalHelper.registerPetal("blue_petals", BLUE_PETALS); + GenericPetalHelper.registerPetal("orchid_petals", ORCHID_PETALS); + GenericPetalHelper.registerPetal("orange_petals", ORANGE_PETALS); + GenericPetalHelper.registerPetal("grey_petals", GREY_PETALS); + GenericPetalHelper.registerPetal("pink_petals", PINK_PETALS); + GenericPetalHelper.registerPetal("white_petals", WHITE_PETALS); + GenericPetalHelper.registerPetal("magenta_petals", MAGENTA_PETALS); + GenericPetalHelper.registerPetal("black_petals", BLACK_PETALS); + + Registry.register(Registries.ITEM_GROUP, ITEM_GROUP, FabricItemGroup.builder() + .displayName(Text.translatable("itemGroup.flower_power.flower_power")) + .icon(() -> new ItemStack(Blocks.TORCHFLOWER)) + .entries((context, entries) -> Arrays.stream(Petals).forEach(entries::add)) + .build()); + } +} diff --git a/fabric/remappedSrc/eu/annsann/flowerpower/Flowers.java b/fabric/remappedSrc/eu/annsann/flowerpower/Flowers.java new file mode 100644 index 0000000..93d3199 --- /dev/null +++ b/fabric/remappedSrc/eu/annsann/flowerpower/Flowers.java @@ -0,0 +1,33 @@ +package eu.annsann.flowerpower; + +import net.minecraft.block.Block; +import net.minecraft.block.FlowerbedBlock; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +public class Flowers { + public static final FlowerbedBlock RED_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock YELLOW_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock BLUE_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock ORCHID_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock ORANGE_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock GREY_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock PINK_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock WHITE_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock MAGENTA_PETALS = GenericPetalHelper.createNewPetal(); + public static final FlowerbedBlock BLACK_PETALS = GenericPetalHelper.createNewPetal(); + + public static final Block[] Petals = { + RED_PETALS, + YELLOW_PETALS, + BLUE_PETALS, + ORCHID_PETALS, + ORANGE_PETALS, + GREY_PETALS, + PINK_PETALS, + WHITE_PETALS, + MAGENTA_PETALS, + BLACK_PETALS + }; +} diff --git a/fabric/remappedSrc/eu/annsann/flowerpower/GenericPetalHelper.java b/fabric/remappedSrc/eu/annsann/flowerpower/GenericPetalHelper.java new file mode 100644 index 0000000..2862883 --- /dev/null +++ b/fabric/remappedSrc/eu/annsann/flowerpower/GenericPetalHelper.java @@ -0,0 +1,37 @@ +package eu.annsann.flowerpower; + +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.FlowerbedBlock; +import net.minecraft.block.piston.PistonBehavior; +import net.minecraft.item.AliasedBlockItem; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.util.Identifier; + +import static eu.annsann.flowerpower.FlowerPower.*; + +public class GenericPetalHelper { + public static FlowerbedBlock createNewPetal() { + return new FlowerbedBlock( + AbstractBlock.Settings + .create() + .noCollision() + .sounds(BlockSoundGroup.PINK_PETALS) + .pistonBehavior(PistonBehavior.DESTROY) + ); + } + + public static void registerPetal(String name, FlowerbedBlock entry) { + Registry.register(Registries.BLOCK, + new Identifier(MOD_NAME, name), + entry); + Registry.register(Registries.ITEM, + new Identifier(MOD_NAME, name), + new BlockItem(entry, new Item.Settings())); + } + +} diff --git a/fabric/remappedSrc/eu/annsann/flowerpower/client/FlowerPowerClient.java b/fabric/remappedSrc/eu/annsann/flowerpower/client/FlowerPowerClient.java new file mode 100644 index 0000000..127f718 --- /dev/null +++ b/fabric/remappedSrc/eu/annsann/flowerpower/client/FlowerPowerClient.java @@ -0,0 +1,24 @@ +package eu.annsann.flowerpower.client; + +import eu.annsann.flowerpower.FlowerPower; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.minecraft.block.Block; +import net.minecraft.client.render.RenderLayer; + +import java.util.Arrays; + +import static eu.annsann.flowerpower.Flowers.*; + +public class FlowerPowerClient implements ClientModInitializer { + /** + * Runs the mod initializer on the client environment. + */ + + @Override + public void onInitializeClient() { + Arrays.stream(Petals).forEach( + block -> BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout()) + ); + } +} diff --git a/fabric/src/main/java/eu/annsann/flowerpower/FlowerPower.java b/fabric/src/main/java/eu/annsann/flowerpower/FlowerPower.java index f744cf7..0dc157f 100644 --- a/fabric/src/main/java/eu/annsann/flowerpower/FlowerPower.java +++ b/fabric/src/main/java/eu/annsann/flowerpower/FlowerPower.java @@ -20,7 +20,7 @@ public class FlowerPower implements ModInitializer { public static final String MOD_NAME = "flower_power"; public static final RegistryKey ITEM_GROUP = RegistryKey.of( RegistryKeys.ITEM_GROUP, - new Identifier(MOD_NAME, MOD_NAME + "_group") + Identifier.of(MOD_NAME, MOD_NAME + "_group") ); /** diff --git a/fabric/src/main/java/eu/annsann/flowerpower/GenericPetalHelper.java b/fabric/src/main/java/eu/annsann/flowerpower/GenericPetalHelper.java index 2862883..c6a200f 100644 --- a/fabric/src/main/java/eu/annsann/flowerpower/GenericPetalHelper.java +++ b/fabric/src/main/java/eu/annsann/flowerpower/GenericPetalHelper.java @@ -27,10 +27,10 @@ public static FlowerbedBlock createNewPetal() { public static void registerPetal(String name, FlowerbedBlock entry) { Registry.register(Registries.BLOCK, - new Identifier(MOD_NAME, name), + Identifier.of(MOD_NAME, name), entry); Registry.register(Registries.ITEM, - new Identifier(MOD_NAME, name), + Identifier.of(MOD_NAME, name), new BlockItem(entry, new Item.Settings())); } diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/black_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/black_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/black_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/black_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/blue_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/blue_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/blue_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/blue_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/grey_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/grey_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/grey_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/grey_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/magenta_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/magenta_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/magenta_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/magenta_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/orange_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/orange_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/orange_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/orange_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/orchid_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/orchid_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/orchid_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/orchid_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/pink_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/pink_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/pink_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/pink_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/red_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/red_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/red_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/red_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/white_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/white_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/white_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/white_petals.json diff --git a/fabric/src/main/resources/data/flower_power/loot_tables/blocks/yellow_petals.json b/fabric/src/main/resources/data/flower_power/loot_table/blocks/yellow_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/loot_tables/blocks/yellow_petals.json rename to fabric/src/main/resources/data/flower_power/loot_table/blocks/yellow_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/black_petals.json b/fabric/src/main/resources/data/flower_power/recipe/black_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/black_petals.json rename to fabric/src/main/resources/data/flower_power/recipe/black_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/blue_petals.json b/fabric/src/main/resources/data/flower_power/recipe/blue_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/blue_petals.json rename to fabric/src/main/resources/data/flower_power/recipe/blue_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/blue_petals_pitcher_plant.json b/fabric/src/main/resources/data/flower_power/recipe/blue_petals_pitcher_plant.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/blue_petals_pitcher_plant.json rename to fabric/src/main/resources/data/flower_power/recipe/blue_petals_pitcher_plant.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/grey_petals_azure.json b/fabric/src/main/resources/data/flower_power/recipe/grey_petals_azure.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/grey_petals_azure.json rename to fabric/src/main/resources/data/flower_power/recipe/grey_petals_azure.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/grey_petals_oxeye.json b/fabric/src/main/resources/data/flower_power/recipe/grey_petals_oxeye.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/grey_petals_oxeye.json rename to fabric/src/main/resources/data/flower_power/recipe/grey_petals_oxeye.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/magenta_petals.json b/fabric/src/main/resources/data/flower_power/recipe/magenta_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/magenta_petals.json rename to fabric/src/main/resources/data/flower_power/recipe/magenta_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/magenta_petals_allium.json b/fabric/src/main/resources/data/flower_power/recipe/magenta_petals_allium.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/magenta_petals_allium.json rename to fabric/src/main/resources/data/flower_power/recipe/magenta_petals_allium.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/orange_petals.json b/fabric/src/main/resources/data/flower_power/recipe/orange_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/orange_petals.json rename to fabric/src/main/resources/data/flower_power/recipe/orange_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/orange_petals_torchflower.json b/fabric/src/main/resources/data/flower_power/recipe/orange_petals_torchflower.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/orange_petals_torchflower.json rename to fabric/src/main/resources/data/flower_power/recipe/orange_petals_torchflower.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/orchid_petals.json b/fabric/src/main/resources/data/flower_power/recipe/orchid_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/orchid_petals.json rename to fabric/src/main/resources/data/flower_power/recipe/orchid_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/pink_petals_peony.json b/fabric/src/main/resources/data/flower_power/recipe/pink_petals_peony.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/pink_petals_peony.json rename to fabric/src/main/resources/data/flower_power/recipe/pink_petals_peony.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/pink_petals_tulip.json b/fabric/src/main/resources/data/flower_power/recipe/pink_petals_tulip.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/pink_petals_tulip.json rename to fabric/src/main/resources/data/flower_power/recipe/pink_petals_tulip.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/red_petals_poppy.json b/fabric/src/main/resources/data/flower_power/recipe/red_petals_poppy.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/red_petals_poppy.json rename to fabric/src/main/resources/data/flower_power/recipe/red_petals_poppy.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/red_petals_rose_bush.json b/fabric/src/main/resources/data/flower_power/recipe/red_petals_rose_bush.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/red_petals_rose_bush.json rename to fabric/src/main/resources/data/flower_power/recipe/red_petals_rose_bush.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/red_petals_tulip.json b/fabric/src/main/resources/data/flower_power/recipe/red_petals_tulip.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/red_petals_tulip.json rename to fabric/src/main/resources/data/flower_power/recipe/red_petals_tulip.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/white_petals_lily.json b/fabric/src/main/resources/data/flower_power/recipe/white_petals_lily.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/white_petals_lily.json rename to fabric/src/main/resources/data/flower_power/recipe/white_petals_lily.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/white_petals_tulip.json b/fabric/src/main/resources/data/flower_power/recipe/white_petals_tulip.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/white_petals_tulip.json rename to fabric/src/main/resources/data/flower_power/recipe/white_petals_tulip.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/yellow_petals.json b/fabric/src/main/resources/data/flower_power/recipe/yellow_petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/yellow_petals.json rename to fabric/src/main/resources/data/flower_power/recipe/yellow_petals.json diff --git a/fabric/src/main/resources/data/flower_power/recipes/yellow_petals_sunflower.json b/fabric/src/main/resources/data/flower_power/recipe/yellow_petals_sunflower.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/recipes/yellow_petals_sunflower.json rename to fabric/src/main/resources/data/flower_power/recipe/yellow_petals_sunflower.json diff --git a/fabric/src/main/resources/data/flower_power/tags/blocks/petals.json b/fabric/src/main/resources/data/flower_power/tags/block/petals.json similarity index 100% rename from fabric/src/main/resources/data/flower_power/tags/blocks/petals.json rename to fabric/src/main/resources/data/flower_power/tags/block/petals.json diff --git a/fabric/src/main/resources/data/minecraft/tags/blocks/flowers.json b/fabric/src/main/resources/data/minecraft/tags/block/flowers.json similarity index 100% rename from fabric/src/main/resources/data/minecraft/tags/blocks/flowers.json rename to fabric/src/main/resources/data/minecraft/tags/block/flowers.json diff --git a/fabric/src/main/resources/data/minecraft/tags/items/flowers.json b/fabric/src/main/resources/data/minecraft/tags/item/flowers.json similarity index 100% rename from fabric/src/main/resources/data/minecraft/tags/items/flowers.json rename to fabric/src/main/resources/data/minecraft/tags/item/flowers.json diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index cae4434..f3e313e 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -23,8 +23,8 @@ ] }, "depends": { - "fabricloader": ">=0.15.10", - "minecraft": "~1.20.5", + "fabricloader": ">=0.15.11", + "minecraft": "~1.21.0", "java": ">=21", "fabric-api": "*" }