/* * Ex Deorum * Copyright (c) 2023 thedarkcolour * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package thedarkcolour.exdeorum.registry; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.Tiers; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.Fluids; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import thedarkcolour.exdeorum.ExDeorum; import thedarkcolour.exdeorum.item.CookedSilkWormItem; import thedarkcolour.exdeorum.item.CrookItem; import thedarkcolour.exdeorum.item.GrassSpreaderItem; import thedarkcolour.exdeorum.item.HammerItem; import thedarkcolour.exdeorum.item.MeshItem; import thedarkcolour.exdeorum.item.NyliumSpreaderItem; import thedarkcolour.exdeorum.item.PorcelainBucket; import thedarkcolour.exdeorum.item.PorcelainMilkBucket; import thedarkcolour.exdeorum.item.SculkCoreItem; import thedarkcolour.exdeorum.item.SilkWormItem; import thedarkcolour.exdeorum.item.WateringCanItem; import thedarkcolour.exdeorum.item.WideWateringCanItem; import thedarkcolour.exdeorum.item.WitchWaterBucketItem; import java.util.List; public class EItems { public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ExDeorum.ID); // Silk Worm public static final RegistryObject SILK_WORM = ITEMS.register("silk_worm", () -> new SilkWormItem(props())); public static final RegistryObject COOKED_SILK_WORM = ITEMS.register("cooked_silk_worm", () -> new CookedSilkWormItem(props().food(new FoodProperties.Builder().nutrition(2).saturationMod(0.6f).build()))); // Crooks public static final RegistryObject CROOK = ITEMS.register("crook", () -> new CrookItem(props().durability(128), 2.0f)); public static final RegistryObject BONE_CROOK = ITEMS.register("bone_crook", () -> new CrookItem(props().durability(312), 4.0f)); // Watering cans public static final RegistryObject WOODEN_WATERING_CAN = ITEMS.register("wooden_watering_can", () -> new WateringCanItem(300, props().stacksTo(1))); public static final RegistryObject STONE_WATERING_CAN = ITEMS.register("stone_watering_can", () -> new WateringCanItem(1000, props().stacksTo(1))); public static final RegistryObject IRON_WATERING_CAN = ITEMS.register("iron_watering_can", () -> new WateringCanItem(2000, props().stacksTo(1))); public static final RegistryObject GOLDEN_WATERING_CAN = ITEMS.register("golden_watering_can", () -> new WateringCanItem(4000, props().stacksTo(1))); public static final RegistryObject DIAMOND_WATERING_CAN = ITEMS.register("diamond_watering_can", () -> new WideWateringCanItem(false, props().stacksTo(1))); public static final RegistryObject NETHERITE_WATERING_CAN = ITEMS.register("netherite_watering_can", () -> new WideWateringCanItem(true, props().stacksTo(1))); // Sieve Meshes public static final RegistryObject STRING_MESH = ITEMS.register("string_mesh", () -> new MeshItem(props().stacksTo(16))); public static final RegistryObject FLINT_MESH = ITEMS.register("flint_mesh", () -> new MeshItem(props().stacksTo(16))); public static final RegistryObject IRON_MESH = ITEMS.register("iron_mesh", () -> new MeshItem(props().stacksTo(16))); public static final RegistryObject GOLDEN_MESH = ITEMS.register("golden_mesh", () -> new MeshItem(props().stacksTo(16))); public static final RegistryObject DIAMOND_MESH = ITEMS.register("diamond_mesh", () -> new MeshItem(props().stacksTo(16))); public static final RegistryObject NETHERITE_MESH = ITEMS.register("netherite_mesh", () -> new MeshItem(props().stacksTo(16))); // Hammers public static final RegistryObject WOODEN_HAMMER = ITEMS.register("wooden_hammer", () -> new HammerItem(Tiers.WOOD, props())); public static final RegistryObject STONE_HAMMER = ITEMS.register("stone_hammer", () -> new HammerItem(Tiers.STONE, props())); public static final RegistryObject GOLDEN_HAMMER = ITEMS.register("golden_hammer", () -> new HammerItem(Tiers.GOLD, props())); public static final RegistryObject IRON_HAMMER = ITEMS.register("iron_hammer", () -> new HammerItem(Tiers.IRON, props())); public static final RegistryObject DIAMOND_HAMMER = ITEMS.register("diamond_hammer", () -> new HammerItem(Tiers.DIAMOND, props())); public static final RegistryObject NETHERITE_HAMMER = ITEMS.register("netherite_hammer", () -> new HammerItem(Tiers.NETHERITE, props())); // Ore Chunks public static final RegistryObject IRON_ORE_CHUNK = registerSimpleItem("iron_ore_chunk"); public static final RegistryObject COPPER_ORE_CHUNK = registerSimpleItem("copper_ore_chunk"); public static final RegistryObject GOLD_ORE_CHUNK = registerSimpleItem("gold_ore_chunk"); // Modded Ore Chunks public static final RegistryObject ALUMINUM_ORE_CHUNK = registerSimpleItem("aluminum_ore_chunk"); public static final RegistryObject COBALT_ORE_CHUNK = registerSimpleItem("cobalt_ore_chunk"); public static final RegistryObject SILVER_ORE_CHUNK = registerSimpleItem("silver_ore_chunk"); public static final RegistryObject LEAD_ORE_CHUNK = registerSimpleItem("lead_ore_chunk"); public static final RegistryObject PLATINUM_ORE_CHUNK = registerSimpleItem("platinum_ore_chunk"); public static final RegistryObject NICKEL_ORE_CHUNK = registerSimpleItem("nickel_ore_chunk"); public static final RegistryObject URANIUM_ORE_CHUNK = registerSimpleItem("uranium_ore_chunk"); public static final RegistryObject OSMIUM_ORE_CHUNK = registerSimpleItem("osmium_ore_chunk"); public static final RegistryObject TIN_ORE_CHUNK = registerSimpleItem("tin_ore_chunk"); public static final RegistryObject ZINC_ORE_CHUNK = registerSimpleItem("zinc_ore_chunk"); public static final RegistryObject IRIDIUM_ORE_CHUNK = registerSimpleItem("iridium_ore_chunk"); // Pebbles public static final RegistryObject STONE_PEBBLE = registerSimpleItem("stone_pebble"); public static final RegistryObject DIORITE_PEBBLE = registerSimpleItem("diorite_pebble"); public static final RegistryObject GRANITE_PEBBLE = registerSimpleItem("granite_pebble"); public static final RegistryObject ANDESITE_PEBBLE = registerSimpleItem("andesite_pebble"); public static final RegistryObject DEEPSLATE_PEBBLE = registerSimpleItem("deepslate_pebble"); public static final RegistryObject TUFF_PEBBLE = registerSimpleItem("tuff_pebble"); public static final RegistryObject CALCITE_PEBBLE = registerSimpleItem("calcite_pebble"); public static final RegistryObject BLACKSTONE_PEBBLE = registerSimpleItem("blackstone_pebble"); public static final RegistryObject BASALT_PEBBLE = registerSimpleItem("basalt_pebble"); // Misc public static final RegistryObject PORCELAIN_CLAY_BALL = registerSimpleItem("porcelain_clay_ball"); public static final RegistryObject GRASS_SEEDS = ITEMS.register("grass_seeds", () -> new GrassSpreaderItem(props(), Blocks.GRASS_BLOCK::defaultBlockState)); public static final RegistryObject MYCELIUM_SPORES = ITEMS.register("mycelium_spores", () -> new GrassSpreaderItem(props(), Blocks.MYCELIUM::defaultBlockState)); public static final RegistryObject WARPED_NYLIUM_SPORES = ITEMS.register("warped_nylium_spores", () -> new NyliumSpreaderItem(props(), Blocks.WARPED_NYLIUM::defaultBlockState)); public static final RegistryObject CRIMSON_NYLIUM_SPORES = ITEMS.register("crimson_nylium_spores", () -> new NyliumSpreaderItem(props(), Blocks.CRIMSON_NYLIUM::defaultBlockState)); public static final RegistryObject SCULK_CORE = ITEMS.register("sculk_core", () -> new SculkCoreItem(props().stacksTo(1))); // Buckets public static final RegistryObject UNFIRED_PORCELAIN_BUCKET = registerSimpleItem("unfired_porcelain_bucket"); public static final RegistryObject PORCELAIN_BUCKET = ITEMS.register("porcelain_bucket", () -> new PorcelainBucket(() -> Fluids.EMPTY, props().stacksTo(16))); public static final RegistryObject PORCELAIN_WATER_BUCKET = ITEMS.register("porcelain_water_bucket", () -> new PorcelainBucket(() -> Fluids.WATER, props().craftRemainder(PORCELAIN_BUCKET.get()).stacksTo(1))); public static final RegistryObject PORCELAIN_LAVA_BUCKET = ITEMS.register("porcelain_lava_bucket", () -> new PorcelainBucket(() -> Fluids.LAVA, props().stacksTo(1))); public static final RegistryObject PORCELAIN_MILK_BUCKET = ITEMS.register("porcelain_milk_bucket", () -> new PorcelainMilkBucket(props().craftRemainder(PORCELAIN_BUCKET.get()).stacksTo(1))); public static final RegistryObject PORCELAIN_WITCH_WATER_BUCKET = ITEMS.register("porcelain_witch_water_bucket", () -> new PorcelainBucket(EFluids.WITCH_WATER, props().craftRemainder(PORCELAIN_BUCKET.get()).stacksTo(1))); // Fluids public static final RegistryObject WITCH_WATER_BUCKET = ITEMS.register("witch_water_bucket", () -> new WitchWaterBucketItem(props().craftRemainder(Items.BUCKET).stacksTo(1))); public static RegistryObject registerSimpleItem(String name) { return ITEMS.register(name, () -> new Item(props())); } // Returns new properties with creative tab set public static Item.Properties props() { return new Item.Properties(); } // Register a block item public static RegistryObject registerItemBlock(RegistryObject block) { return ITEMS.register(block.getId().getPath(), () -> new BlockItem(block.get(), props())); } // BlockItems public static final RegistryObject DUST = registerItemBlock(EBlocks.DUST); public static final RegistryObject CRUSHED_NETHERRACK = registerItemBlock(EBlocks.CRUSHED_NETHERRACK); public static final RegistryObject CRUSHED_END_STONE = registerItemBlock(EBlocks.CRUSHED_END_STONE); public static final RegistryObject CRUSHED_DEEPSLATE = registerItemBlock(EBlocks.CRUSHED_DEEPSLATE); public static final RegistryObject CRUSHED_BLACKSTONE = registerItemBlock(EBlocks.CRUSHED_BLACKSTONE); // Barrels public static final RegistryObject OAK_BARREL = registerItemBlock(EBlocks.OAK_BARREL); public static final RegistryObject SPRUCE_BARREL = registerItemBlock(EBlocks.SPRUCE_BARREL); public static final RegistryObject BIRCH_BARREL = registerItemBlock(EBlocks.BIRCH_BARREL); public static final RegistryObject JUNGLE_BARREL = registerItemBlock(EBlocks.JUNGLE_BARREL); public static final RegistryObject ACACIA_BARREL = registerItemBlock(EBlocks.ACACIA_BARREL); public static final RegistryObject DARK_OAK_BARREL = registerItemBlock(EBlocks.DARK_OAK_BARREL); public static final RegistryObject MANGROVE_BARREL = registerItemBlock(EBlocks.MANGROVE_BARREL); public static final RegistryObject CHERRY_BARREL = registerItemBlock(EBlocks.CHERRY_BARREL); public static final RegistryObject BAMBOO_BARREL = registerItemBlock(EBlocks.BAMBOO_BARREL); public static final RegistryObject CRIMSON_BARREL = registerItemBlock(EBlocks.CRIMSON_BARREL); public static final RegistryObject WARPED_BARREL = registerItemBlock(EBlocks.WARPED_BARREL); public static final RegistryObject STONE_BARREL = registerItemBlock(EBlocks.STONE_BARREL); // Sieves public static final RegistryObject OAK_SIEVE = registerItemBlock(EBlocks.OAK_SIEVE); public static final RegistryObject SPRUCE_SIEVE = registerItemBlock(EBlocks.SPRUCE_SIEVE); public static final RegistryObject BIRCH_SIEVE = registerItemBlock(EBlocks.BIRCH_SIEVE); public static final RegistryObject JUNGLE_SIEVE = registerItemBlock(EBlocks.JUNGLE_SIEVE); public static final RegistryObject ACACIA_SIEVE = registerItemBlock(EBlocks.ACACIA_SIEVE); public static final RegistryObject DARK_OAK_SIEVE = registerItemBlock(EBlocks.DARK_OAK_SIEVE); public static final RegistryObject MANGROVE_SIEVE = registerItemBlock(EBlocks.MANGROVE_SIEVE); public static final RegistryObject CHERRY_SIEVE = registerItemBlock(EBlocks.CHERRY_SIEVE); public static final RegistryObject BAMBOO_SIEVE = registerItemBlock(EBlocks.BAMBOO_SIEVE); public static final RegistryObject CRIMSON_SIEVE = registerItemBlock(EBlocks.CRIMSON_SIEVE); public static final RegistryObject WARPED_SIEVE = registerItemBlock(EBlocks.WARPED_SIEVE); // Lava Crucibles public static final RegistryObject PORCELAIN_CRUCIBLE = registerItemBlock(EBlocks.PORCELAIN_CRUCIBLE); public static final RegistryObject WARPED_CRUCIBLE = registerItemBlock(EBlocks.WARPED_CRUCIBLE); public static final RegistryObject CRIMSON_CRUCIBLE = registerItemBlock(EBlocks.CRIMSON_CRUCIBLE); public static final RegistryObject UNFIRED_PORCELAIN_CRUCIBLE = registerItemBlock(EBlocks.UNFIRED_PORCELAIN_CRUCIBLE); // Water Crucibles public static final RegistryObject OAK_CRUCIBLE = registerItemBlock(EBlocks.OAK_CRUCIBLE); public static final RegistryObject SPRUCE_CRUCIBLE = registerItemBlock(EBlocks.SPRUCE_CRUCIBLE); public static final RegistryObject BIRCH_CRUCIBLE = registerItemBlock(EBlocks.BIRCH_CRUCIBLE); public static final RegistryObject JUNGLE_CRUCIBLE = registerItemBlock(EBlocks.JUNGLE_CRUCIBLE); public static final RegistryObject ACACIA_CRUCIBLE = registerItemBlock(EBlocks.ACACIA_CRUCIBLE); public static final RegistryObject DARK_OAK_CRUCIBLE = registerItemBlock(EBlocks.DARK_OAK_CRUCIBLE); public static final RegistryObject MANGROVE_CRUCIBLE = registerItemBlock(EBlocks.MANGROVE_CRUCIBLE); public static final RegistryObject CHERRY_CRUCIBLE = registerItemBlock(EBlocks.CHERRY_CRUCIBLE); public static final RegistryObject BAMBOO_CRUCIBLE = registerItemBlock(EBlocks.BAMBOO_CRUCIBLE); public static final RegistryObject END_CAKE = registerItemBlock(EBlocks.END_CAKE); public static void addItemsToMainTab(CreativeModeTab.Output output) { output.accept(OAK_BARREL.get()); output.accept(SPRUCE_BARREL.get()); output.accept(BIRCH_BARREL.get()); output.accept(JUNGLE_BARREL.get()); output.accept(ACACIA_BARREL.get()); output.accept(DARK_OAK_BARREL.get()); output.accept(MANGROVE_BARREL.get()); output.accept(CHERRY_BARREL.get()); output.accept(BAMBOO_BARREL.get()); output.accept(CRIMSON_BARREL.get()); output.accept(WARPED_BARREL.get()); output.accept(STONE_BARREL.get()); output.accept(OAK_SIEVE.get()); output.accept(SPRUCE_SIEVE.get()); output.accept(BIRCH_SIEVE.get()); output.accept(JUNGLE_SIEVE.get()); output.accept(ACACIA_SIEVE.get()); output.accept(DARK_OAK_SIEVE.get()); output.accept(MANGROVE_SIEVE.get()); output.accept(CHERRY_SIEVE.get()); output.accept(BAMBOO_SIEVE.get()); output.accept(CRIMSON_SIEVE.get()); output.accept(WARPED_SIEVE.get()); output.accept(PORCELAIN_CRUCIBLE.get()); output.accept(WARPED_CRUCIBLE.get()); output.accept(CRIMSON_CRUCIBLE.get()); output.accept(UNFIRED_PORCELAIN_CRUCIBLE.get()); output.accept(OAK_CRUCIBLE.get()); output.accept(SPRUCE_CRUCIBLE.get()); output.accept(BIRCH_CRUCIBLE.get()); output.accept(JUNGLE_CRUCIBLE.get()); output.accept(ACACIA_CRUCIBLE.get()); output.accept(DARK_OAK_CRUCIBLE.get()); output.accept(MANGROVE_CRUCIBLE.get()); output.accept(CHERRY_CRUCIBLE.get()); output.accept(BAMBOO_CRUCIBLE.get()); output.accept(DUST.get()); output.accept(CRUSHED_NETHERRACK.get()); output.accept(CRUSHED_END_STONE.get()); output.accept(CRUSHED_DEEPSLATE.get()); output.accept(CRUSHED_BLACKSTONE.get()); output.accept(END_CAKE.get()); output.accept(SILK_WORM.get()); output.accept(COOKED_SILK_WORM.get()); output.accept(CROOK.get()); output.accept(BONE_CROOK.get()); var wateringCans = List.of(WOODEN_WATERING_CAN, STONE_WATERING_CAN, IRON_WATERING_CAN, GOLDEN_WATERING_CAN, DIAMOND_WATERING_CAN, NETHERITE_WATERING_CAN); for (var wateringCan : wateringCans) { var full = WateringCanItem.getFull(wateringCan); output.accept(wateringCan.get()); output.accept(full); } output.accept(STRING_MESH.get()); output.accept(FLINT_MESH.get()); output.accept(IRON_MESH.get()); output.accept(GOLDEN_MESH.get()); output.accept(DIAMOND_MESH.get()); output.accept(NETHERITE_MESH.get()); output.accept(WOODEN_HAMMER.get()); output.accept(STONE_HAMMER.get()); output.accept(GOLDEN_HAMMER.get()); output.accept(IRON_HAMMER.get()); output.accept(DIAMOND_HAMMER.get()); output.accept(NETHERITE_HAMMER.get()); output.accept(IRON_ORE_CHUNK.get()); output.accept(COPPER_ORE_CHUNK.get()); output.accept(GOLD_ORE_CHUNK.get()); output.accept(STONE_PEBBLE.get()); output.accept(DIORITE_PEBBLE.get()); output.accept(GRANITE_PEBBLE.get()); output.accept(ANDESITE_PEBBLE.get()); output.accept(DEEPSLATE_PEBBLE.get()); output.accept(TUFF_PEBBLE.get()); output.accept(CALCITE_PEBBLE.get()); output.accept(BLACKSTONE_PEBBLE.get()); output.accept(BASALT_PEBBLE.get()); output.accept(GRASS_SEEDS.get()); output.accept(MYCELIUM_SPORES.get()); output.accept(WARPED_NYLIUM_SPORES.get()); output.accept(CRIMSON_NYLIUM_SPORES.get()); output.accept(SCULK_CORE.get()); output.accept(WITCH_WATER_BUCKET.get()); output.accept(PORCELAIN_CLAY_BALL.get()); output.accept(UNFIRED_PORCELAIN_BUCKET.get()); output.accept(PORCELAIN_BUCKET.get()); output.accept(PORCELAIN_WATER_BUCKET.get()); output.accept(PORCELAIN_LAVA_BUCKET.get()); output.accept(PORCELAIN_MILK_BUCKET.get()); output.accept(PORCELAIN_WITCH_WATER_BUCKET.get()); } }