summary refs log blame commit diff stats
path: root/src/main/java/ganarchy/chewstuff/ChewStuff.java
blob: ee035f3f1e94226499e956d83bed31a5c0452fd4 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                       
                                                            
                               


                                         
                                     
















                                                                             
                           









                                                               
                                                         





                                                            
                                                         





                                                          
                                                         










                                                                                
                            



                                                    
                            



                                                     
                            



                                                       
                            


                                                     







                                                                                        

     
package ganarchy.chewstuff;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The mod's entry point.
 */
public class ChewStuff implements ModInitializer {
    /**
     * The ChewStuff Logger.
     */
    public static final Logger LOGGER = LoggerFactory.getLogger("chewstuff");

    /**
     * Silicone. Not to be confused with silicon. Crafting material for
     * chews.
     */
    public static final Item SILICONE = new Item(
        new Item.Settings()
    );
    /**
     * 1 day, in ticks.
     */
    public static final int DAY_MULTIPLIER = 24 * 60 * 60 * 20;
    /**
     * Soft chew. Lasts 5 days, 1 effect slot.
     */
    public static final Item SOFT_CHEW = new ChewableItem(
        1,
        new Item.Settings().maxDamage(5 * DAY_MULTIPLIER)
    );
    /**
     * Medium chew. Lasts 6 days, 2 effect slots.
     */
    public static final Item MEDIUM_CHEW = new ChewableItem(
        2,
        new Item.Settings().maxDamage(6 * DAY_MULTIPLIER)
    );
    /**
     * Hard chew. Lasts 7 days, 3 effect slots.
     */
    public static final Item HARD_CHEW = new ChewableItem(
        3,
        new Item.Settings().maxDamage(7 * DAY_MULTIPLIER)
    );

    @Override
    public void onInitialize() {
        // This code runs as soon as Minecraft is in a mod-load-ready state.
        // However, some things (like resources) may still be uninitialized.
        // Proceed with mild caution.

        LOGGER.info("This software is made with love by a queer trans person.");

        Registry.register(
            Registries.ITEM,
            new Identifier("chewstuff", "silicone"),
            SILICONE
        );
        Registry.register(
            Registries.ITEM,
            new Identifier("chewstuff", "soft_chew"),
            SOFT_CHEW
        );
        Registry.register(
            Registries.ITEM,
            new Identifier("chewstuff", "medium_chew"),
            MEDIUM_CHEW
        );
        Registry.register(
            Registries.ITEM,
            new Identifier("chewstuff", "hard_chew"),
            HARD_CHEW
        );
        ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(content -> {
            content.add(SOFT_CHEW);
            content.add(MEDIUM_CHEW);
            content.add(HARD_CHEW);
        });
        ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> {
            content.add(SILICONE);
        });
    }
}