summary refs log tree commit diff stats
path: root/src/main/java/ganarchy/chewstuff/ChewStuff.java
blob: ee035f3f1e94226499e956d83bed31a5c0452fd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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);
        });
    }
}