|
| 1 | +package eu.annsann.flowerpower; |
| 2 | + |
| 3 | +import net.fabricmc.api.ModInitializer; |
| 4 | +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; |
| 5 | +import net.minecraft.block.*; |
| 6 | +import net.minecraft.item.ItemGroup; |
| 7 | +import net.minecraft.item.ItemStack; |
| 8 | +import net.minecraft.registry.Registries; |
| 9 | +import net.minecraft.registry.Registry; |
| 10 | +import net.minecraft.registry.RegistryKey; |
| 11 | +import net.minecraft.registry.RegistryKeys; |
| 12 | +import net.minecraft.text.Text; |
| 13 | +import net.minecraft.util.Identifier; |
| 14 | + |
| 15 | +import java.util.Arrays; |
| 16 | + |
| 17 | +import static eu.annsann.flowerpower.Flowers.*; |
| 18 | + |
| 19 | +public class FlowerPower implements ModInitializer { |
| 20 | + public static final String MOD_NAME = "flower_power"; |
| 21 | + public static final RegistryKey<ItemGroup> ITEM_GROUP = RegistryKey.of( |
| 22 | + RegistryKeys.ITEM_GROUP, |
| 23 | + new Identifier(MOD_NAME, MOD_NAME + "_group") |
| 24 | + ); |
| 25 | + |
| 26 | + /** |
| 27 | + * Runs the mod initializer. |
| 28 | + */ |
| 29 | + @Override |
| 30 | + public void onInitialize() { |
| 31 | + GenericPetalHelper.registerPetal("red_petals", RED_PETALS); |
| 32 | + GenericPetalHelper.registerPetal("yellow_petals", YELLOW_PETALS); |
| 33 | + GenericPetalHelper.registerPetal("blue_petals", BLUE_PETALS); |
| 34 | + GenericPetalHelper.registerPetal("orchid_petals", ORCHID_PETALS); |
| 35 | + GenericPetalHelper.registerPetal("orange_petals", ORANGE_PETALS); |
| 36 | + GenericPetalHelper.registerPetal("grey_petals", GREY_PETALS); |
| 37 | + GenericPetalHelper.registerPetal("pink_petals", PINK_PETALS); |
| 38 | + GenericPetalHelper.registerPetal("white_petals", WHITE_PETALS); |
| 39 | + GenericPetalHelper.registerPetal("magenta_petals", MAGENTA_PETALS); |
| 40 | + GenericPetalHelper.registerPetal("black_petals", BLACK_PETALS); |
| 41 | + |
| 42 | + Registry.register(Registries.ITEM_GROUP, ITEM_GROUP, FabricItemGroup.builder() |
| 43 | + .displayName(Text.translatable("itemGroup.flower_power.flower_power")) |
| 44 | + .icon(() -> new ItemStack(Blocks.TORCHFLOWER)) |
| 45 | + .entries((context, entries) -> Arrays.stream(Petals).forEach(entries::add)) |
| 46 | + .build()); |
| 47 | + } |
| 48 | +} |
0 commit comments