Search in sources :

Example 6 with RepairKitItem

use of net.silentchaos512.gear.item.RepairKitItem in project Silent-Gear by SilentChaos512.

the class ModRecipesProvider method registerModifierKits.

private void registerModifierKits(Consumer<FinishedRecipe> consumer) {
    ShapedRecipeBuilder.shaped(ModItems.MOD_KIT).define('#', ModTags.Items.TEMPLATE_BOARDS).define('/', Tags.Items.RODS_WOODEN).define('o', Tags.Items.INGOTS_IRON).pattern("##o").pattern("##/").unlockedBy("has_item", has(ModTags.Items.TEMPLATE_BOARDS)).save(consumer);
    ShapedRecipeBuilder.shaped(ModItems.VERY_CRUDE_REPAIR_KIT).define('#', ModTags.Items.TEMPLATE_BOARDS).define('/', Tags.Items.RODS_WOODEN).define('o', Tags.Items.STONE).pattern(" / ").pattern("#o#").pattern("###").unlockedBy("has_item", has(ModTags.Items.TEMPLATE_BOARDS)).save(consumer);
    ShapedRecipeBuilder.shaped(ModItems.CRUDE_REPAIR_KIT).define('#', ModTags.Items.TEMPLATE_BOARDS).define('/', Tags.Items.RODS_WOODEN).define('o', Tags.Items.INGOTS_IRON).pattern(" / ").pattern("#o#").pattern("###").unlockedBy("has_item", has(ModTags.Items.TEMPLATE_BOARDS)).save(consumer);
    ShapedRecipeBuilder.shaped(ModItems.STURDY_REPAIR_KIT).define('#', Tags.Items.INGOTS_IRON).define('/', ModTags.Items.RODS_IRON).define('o', Tags.Items.GEMS_DIAMOND).pattern(" / ").pattern("#o#").pattern("###").unlockedBy("has_item", has(Tags.Items.INGOTS_IRON)).save(consumer);
    ShapedRecipeBuilder.shaped(ModItems.CRIMSON_REPAIR_KIT).define('#', ModTags.Items.INGOTS_CRIMSON_STEEL).define('/', Tags.Items.RODS_BLAZE).define('o', ModTags.Items.INGOTS_BLAZE_GOLD).pattern(" / ").pattern("#o#").pattern("###").unlockedBy("has_item", has(ModTags.Items.INGOTS_CRIMSON_STEEL)).save(consumer);
    ShapedRecipeBuilder.shaped(ModItems.AZURE_REPAIR_KIT).define('#', ModTags.Items.INGOTS_AZURE_ELECTRUM).define('/', Items.END_ROD).define('o', Tags.Items.GEMS_EMERALD).pattern(" / ").pattern("#o#").pattern("###").unlockedBy("has_item", has(ModTags.Items.INGOTS_AZURE_ELECTRUM)).save(consumer);
    for (RepairKitItem item : Registration.getItems(RepairKitItem.class)) {
        // Empty repair kit recipes
        ExtendedShapelessRecipeBuilder.vanillaBuilder(item).addIngredient(item).addIngredient(Tags.Items.RODS_WOODEN).build(consumer, SilentGear.getId(NameUtils.from(item).getPath() + "_empty"));
    }
}
Also used : RepairKitItem(net.silentchaos512.gear.item.RepairKitItem)

Example 7 with RepairKitItem

use of net.silentchaos512.gear.item.RepairKitItem in project Silent-Gear by SilentChaos512.

the class FillRepairKitRecipe method matches.

@Override
public boolean matches(CraftingContainer inv, Level worldIn) {
    // Need 1 repair kit and 1+ mats
    boolean kitFound = false;
    int matsFound = 0;
    for (int i = 0; i < inv.getContainerSize(); ++i) {
        ItemStack stack = inv.getItem(i);
        if (!stack.isEmpty()) {
            if (stack.getItem() instanceof RepairKitItem) {
                if (kitFound) {
                    return false;
                }
                kitFound = true;
            } else if (isRepairMaterial(stack)) {
                ++matsFound;
            } else {
                return false;
            }
        }
    }
    return kitFound && matsFound > 0;
}
Also used : RepairKitItem(net.silentchaos512.gear.item.RepairKitItem) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

RepairKitItem (net.silentchaos512.gear.item.RepairKitItem)7 ItemStack (net.minecraft.world.item.ItemStack)6 ICoreItem (net.silentchaos512.gear.api.item.ICoreItem)3 StackList (net.silentchaos512.lib.collection.StackList)3 ArrayList (java.util.ArrayList)2 JsonObject (com.google.gson.JsonObject)1 Collection (java.util.Collection)1 List (java.util.List)1 NonNullList (net.minecraft.core.NonNullList)1 FriendlyByteBuf (net.minecraft.network.FriendlyByteBuf)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 CraftingContainer (net.minecraft.world.inventory.CraftingContainer)1 Item (net.minecraft.world.item.Item)1 CustomRecipe (net.minecraft.world.item.crafting.CustomRecipe)1 RecipeSerializer (net.minecraft.world.item.crafting.RecipeSerializer)1 Level (net.minecraft.world.level.Level)1 ForgeHooks (net.minecraftforge.common.ForgeHooks)1 ForgeRegistryEntry (net.minecraftforge.registries.ForgeRegistryEntry)1 ICoreTool (net.silentchaos512.gear.api.item.ICoreTool)1 ItemStats (net.silentchaos512.gear.api.stats.ItemStats)1