diff options
| author | 2024-01-09 19:37:28 +0100 | |
|---|---|---|
| committer | 2024-01-09 19:37:28 +0100 | |
| commit | 4606c536a6260477870426234f748067240de3d1 (patch) | |
| tree | 52ecd35ab0a51dd84bbebb675f5433a85166b132 /src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyItems.java | |
| parent | Replace ItemMixin.java with proper ItemTooltipCallback usage. (diff) | |
| download | mc-eris-alchemy-4606c536a6260477870426234f748067240de3d1.tar.gz mc-eris-alchemy-4606c536a6260477870426234f748067240de3d1.tar.xz mc-eris-alchemy-4606c536a6260477870426234f748067240de3d1.zip | |
Added Alchemical Chest.
Diffstat (limited to 'src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyItems.java')
| -rw-r--r-- | src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyItems.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyItems.java b/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyItems.java new file mode 100644 index 0000000..21bcc7f --- /dev/null +++ b/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyItems.java | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | package lv.enes.mc.eris_alchemy; | ||
| 2 | |||
| 3 | import lv.enes.mc.eris_alchemy.block.ErisAlchemyBlocks; | ||
| 4 | import net.minecraft.core.registries.BuiltInRegistries; | ||
| 5 | import net.minecraft.resources.ResourceLocation; | ||
| 6 | import net.minecraft.world.item.BlockItem; | ||
| 7 | import net.minecraft.world.item.Item; | ||
| 8 | import net.minecraft.world.item.Rarity; | ||
| 9 | import net.minecraft.world.level.block.Block; | ||
| 10 | import org.quiltmc.qsl.item.setting.api.QuiltItemSettings; | ||
| 11 | |||
| 12 | import java.util.LinkedHashMap; | ||
| 13 | import java.util.Map; | ||
| 14 | import java.util.function.BiConsumer; | ||
| 15 | |||
| 16 | public final class ErisAlchemyItems { | ||
| 17 | private static final Map<ResourceLocation, Item> items = new LinkedHashMap<>(); | ||
| 18 | |||
| 19 | public static final Item ALCHEMICAL_CHEST = register(ErisAlchemyBlocks.ALCHEMICAL_CHEST, new QuiltItemSettings().rarity(Rarity.RARE)); | ||
| 20 | public static final Item LOW_COVALENCE_DUST = register("low_covalence_dust", new Item(new QuiltItemSettings().rarity(Rarity.COMMON))); | ||
| 21 | @SuppressWarnings("unused") | ||
| 22 | public static final Item MEDIUM_COVALENCE_DUST = register("medium_covalence_dust", new Item(new QuiltItemSettings().rarity(Rarity.UNCOMMON))); | ||
| 23 | @SuppressWarnings("unused") | ||
| 24 | public static final Item HIGH_COVALENCE_DUST = register("high_covalence_dust", new Item(new QuiltItemSettings().rarity(Rarity.RARE))); | ||
| 25 | |||
| 26 | public static void consumeItems(BiConsumer<? super ResourceLocation, ? super Item> consumer) { | ||
| 27 | items.forEach(consumer); | ||
| 28 | } | ||
| 29 | |||
| 30 | private static BlockItem register(Block block, QuiltItemSettings settings) { | ||
| 31 | return register(BuiltInRegistries.BLOCK.getKey(block), new BlockItem(block, settings)); | ||
| 32 | } | ||
| 33 | |||
| 34 | private static <T extends Item> T register(String id, T item) { | ||
| 35 | return register(new ResourceLocation(ErisAlchemy.ID, id), item); | ||
| 36 | } | ||
| 37 | |||
| 38 | private static <T extends Item> T register(ResourceLocation id, T item) { | ||
| 39 | items.putIfAbsent(id, item); | ||
| 40 | return item; | ||
| 41 | } | ||
| 42 | |||
| 43 | private ErisAlchemyItems() {} | ||
| 44 | } | ||