Jump to content

Recommended Posts

Posted

Hello people

I am working on a mod and it adds a new crafting table with its own recipes and it works, but the output slot doesnt show the item the recipe is resulting, even though if you click on the slot with no items, it crafts the item like it should.

I have tried a lot of changes on the code and it still doesnt show the right output, anyone has an ideia of what is happening?

 

Crafting Manager

 

package torresmon235.crystalgun.crafting;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World;
import torresmon235.crystalgun.common.CrystalGunMain;

public class AlchemyManager
{
    /** The static instance of this class */
    private static final AlchemyManager instance = new AlchemyManager();

    /** A list of all the recipes added */
    private List recipes = new ArrayList();

    /**
     * Returns the static instance of this class
     */
    public static final AlchemyManager getInstance()
    {
        return instance;
    }

    private AlchemyManager()
    {
        this.addRecipe(new ItemStack(CrystalGunMain.PoisonCrystal, 3), new Object[] {"F", "W", "F", 'F', CrystalGunMain.FireCrystal, 'W', CrystalGunMain.WaterCrystal});
        this.addRecipe(new ItemStack(CrystalGunMain.PoisonCrystal, 2), new Object[] {"G", "F", 'F', CrystalGunMain.FireCrystal, 'G', CrystalGunMain.GrassCrystal});
        this.addRecipe(new ItemStack(CrystalGunMain.GrassCrystal, 2), new Object[] {"F", "W", 'F', CrystalGunMain.FireCrystal, 'W', CrystalGunMain.WaterCrystal});
        this.addRecipe(new ItemStack(CrystalGunMain.IceCrystal, 2), new Object[] {"A", "W", 'A', CrystalGunMain.AirCrystal, 'W', CrystalGunMain.WaterCrystal});
        this.addRecipe(new ItemStack(CrystalGunMain.SandCrystal, 2), new Object[] {"F", "A", 'F', CrystalGunMain.FireCrystal, 'A', CrystalGunMain.AirCrystal});
        this.addRecipe(new ItemStack(CrystalGunMain.LifeCrystal, 6), new Object[] {"FWA", "PPP", "GIS", 'F', CrystalGunMain.FireCrystal, 'W', CrystalGunMain.WaterCrystal, 'A', CrystalGunMain.AirCrystal, 'G', CrystalGunMain.GrassCrystal, 'I', CrystalGunMain.IceCrystal, 'S', CrystalGunMain.SandCrystal, 'P', Item.gunpowder});
        System.out.println(this.recipes.size() + " Achemy Recipes");
    }

    void addRecipe(ItemStack itemstack, Object ... inputArray)
    {
             String var3 = "";
             int var4 = 0;
             int var5 = 0;
             int var6 = 0;
             int var9;
             if (inputArray[var4] instanceof String[])
             {
                     String[] var7 = (String[])((String[])inputArray[var4++]);
                     String[] var8 = var7;
                     var9 = var7.length;
                     for (int var10 = 0; var10 < var9; ++var10)
                     {
                             String var11 = var8[var10];
                             ++var6;
                             var5 = var11.length();
                             var3 = var3 + var11;
                     }
             }
             else
             {
                     while (inputArray[var4] instanceof String)
                     {
                             String var13 = (String)inputArray[var4++];
                             ++var6;
                             var5 = var13.length();
                             var3 = var3 + var13;
                     }
             }
             HashMap var14;
             for (var14 = new HashMap(); var4 < inputArray.length; var4 += 2)
             {
                     Character var16 = (Character)inputArray[var4];
                     ItemStack var17 = null;
                     if (inputArray[var4 + 1] instanceof Item)
                     {
                             var17 = new ItemStack((Item)inputArray[var4 + 1]);
                     }
                     else if (inputArray[var4 + 1] instanceof Block)
                     {
                             var17 = new ItemStack((Block)inputArray[var4 + 1], 1, -1);
                     }
                     else if (inputArray[var4 + 1] instanceof ItemStack)
                     {
                             var17 = (ItemStack)inputArray[var4 + 1];
                     }
                     var14.put(var16, var17);
             }
             ItemStack[] var15 = new ItemStack[var5 * var6];
             for (var9 = 0; var9 < var5 * var6; ++var9)
             {
                     char var18 = var3.charAt(var9);
                     if (var14.containsKey(Character.valueOf(var18)))
                     {
                             var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy();
                     }
                     else
                     {
                             var15[var9] = null;
                     }
             }
             this.recipes.add(new ShapedRecipes(var5, var6, var15, itemstack));
    }
    
    void addShapelessRecipe(ItemStack itemstack, Object ... inputArray)
    {
             ArrayList var3 = new ArrayList();
             Object[] var4 = inputArray;
             int var5 = inputArray.length;
             for (int var6 = 0; var6 < var5; ++var6)
             {
                     Object var7 = var4[var6];
                     if (var7 instanceof ItemStack)
                     {
                             var3.add(((ItemStack)var7).copy());
                     }
                     else if (var7 instanceof Item)
                     {
                             var3.add(new ItemStack((Item)var7));
                     }
                     else
                     {
                             if (!(var7 instanceof Block))
                             {
                                     throw new RuntimeException("Invalid shapeless recipy!");
                             }
                             var3.add(new ItemStack((Block)var7));
                     }
             }
             this.recipes.add(new ShapelessRecipes(itemstack, var3));
    }

    public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World)
    {
        int var3 = 0;
        ItemStack var4 = null;
        ItemStack var5 = null;
        int var6;

        for (var6 = 0; var6 < par1InventoryCrafting.getSizeInventory(); ++var6)
        {
            ItemStack var7 = par1InventoryCrafting.getStackInSlot(var6);

            if (var7 != null)
            {
                if (var3 == 0)
                {
                    var4 = var7;
                }

                if (var3 == 1)
                {
                    var5 = var7;
                }

                ++var3;
            }
        }

        if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isRepairable())
        {
            Item var11 = Item.itemsList[var4.itemID];
            int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay();
            int var8 = var11.getMaxDamage() - var5.getItemDamageForDisplay();
            int var9 = var13 + var8 + var11.getMaxDamage() * 5 / 100;
            int var10 = var11.getMaxDamage() - var9;

            if (var10 < 0)
            {
                var10 = 0;
            }

            return new ItemStack(var4.itemID, 1, var10);
        }
        else
        {
            for (var6 = 0; var6 < this.recipes.size(); ++var6)
            {
                IRecipe var12 = (IRecipe)this.recipes.get(var6);

                if (var12.matches(par1InventoryCrafting, par2World))
                {
                    return var12.getCraftingResult(par1InventoryCrafting);
                }
            }

            return null;
        }
    }

    /**
     * returns the List<> of all recipes
     */
    public List getRecipeList()
    {
        return this.recipes;
    }
}

 

Posted

After some testing, it seems like the output shows icons for the normal crafting table recipes, if i try to make a fence, it shows on the output but it wont let me grab the fences. And if i try a recipe from the custom table the icon wont show up, but if i try to grab it will craft the item.

I have been looking for the code that shows the output icon, but with no luck, anyone knows where can i find and change it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • You need a new "items" folder at  resources/assets/yourmodid/ there you add for every item model a .json file with the exact item/block name and fill it like this if it's an item: { "model": { "type": "minecraft:model", "model": "yourmodid:item/youritem" } } and so if its a block: { "model": { "type": "minecraft:model", "model": "yourmodid:block/youritem" } } There is also a generator for it you can do namy crazy things with it which replaces the previous hard coded Item Properties implementaion method (Bow pulling animation for example). https://misode.github.io/assets/item/
    • Hello! I'm playing a modpack (custom made) with some friends, and we have the server running on BisectHosting. We encountered a bug with an entity from The Box Of Horrors mod, that would crash the game whenever someone nearby it would log in. We tried to fix it by: 1) Editing the player.dat files to change the location of the affected players (something I had done successfully previously) 2) Updating the version of the mod we had (0.0.8.2) to the latest alpha version (0.0.8.3 However, after doing both of those, none of us are able to join the server, and we get the following errors: Server side: https://pastebin.com/J5sc3VQN Client side: Internal Server Error (that's basically all I've gotten) Please help! I've tried restoring the player data to how it was before I made the changes (Bisect allows you to restore deleted files) and deleting all of my player data files and I still get the same error. Deleting Box Of Horrors causes the error: Failed to load datapacks, cannot continue with server load.
    • Get $100 Off temu Coupon Code { ald123454 } | for new users + 30% Discount for all users You can get a $100 Off temu Coupon code using the code { ald123454 }. This temu $100 Off code is specifically for new customers and can be redeemed to receive a $100 discount on your purchase. Our exclusive temu Coupon code offers a flat $100 Off your purchase, plus an additional 30% discount. As a new temu customer, you can slash prices by up to 30% as a new temu customer using code { ald123454 }. Existing users can enjoy $100 Off their next haul with this code. But that’s not all! With our temu coupon code get up to 90% discount on select items and clearance sales. Whether you’re a new customer or an existing shopper, our temu codes provide extra discounts tailored just for you. Save up to 30% with these current temu Coupons { ald123454 } for February 2025. The latest temu coupon codes at here. Free temu codes $100 Off — { ald123454 } temu Coupon $100 Off — { ald123454 } temu Coupon $100 Off — { ald123454 } temu Memorial Day Sale 75% off — { ald123454 } temu Coupon code today — { ald123454 } temu free gift code — { ald123454 } Without inviting friends or family member  Coupon code for Canada - $100 Off— { ald123454 } temu Coupon code Australia - $100 Off— { ald123454 } temu Coupon code New Zealand - $100 Off — { ald123454 } temu Coupon code Japan -$100 Off — { ald123454 } temu Coupon code Mexico - $100 Off — { ald123454 } temu Coupon code Chile - $100 Off — { ald123454 } temu Coupon code Peru - $100 Off — { ald123454 } temu Coupon code Colombia - $100 Off — { ald123454 } temu Coupon code Malaysia - $100 Off — { ald123454 } temu Coupon code the Philippines - $100 Off — { ald123454 } temu Coupon code South Korea - $100 Off — { ald123454 } Redeem Free temu Coupon Code { ald123454 }for first time user Get $100 discount on your temu order with the promo code "acr804084". You can get a discount by clicking on the item to purchase and entering this temu Coupon code $100 Off "{ ald123454 }". temu Coupon Code { ald123454 }: Get Up To $100 Off In June 2025 Are you looking for the best temu Coupon codes to get amazing discounts? Our temu Coupons are perfect for getting those extra savings you crave. We regularly test our coupon codes for temu to ensure they work flawlessly, giving you a guaranteed discount every time. temu New User Coupon { ald123454 }: Up To 75% OFF For First-Time Users Our temu first-time user coupon codes are designed just for new customers, offering the biggest discounts and the best deals currently available on temu. To maximize your savings, download the temu Coupon For $100 Off { ald123454 }: Get A Flat $100 Discount On Order Value Get ready to save big with our incredible temu Coupon code for $100 Off! Our amazing temu $100 Off coupon code will give you a flat $100 discount on your order value, making your shopping experience even more rewarding. temu Coupon Code For $100 Off { ald123454 } For Both New And Existing Customers Our incredible temu Coupon code for $100 Off is here to help you save big on your purchases. Whether you’re a new user or an existing customer, our $100 Off code for temu will give you an additional discount! temu Coupon Bundle { ald123454 }: Flat $100 Off + Up To 30% Discount Get ready for an unbelievable deal with our temu Coupon bundle for 2025! Our temu Coupon bundles will give you a flat $100 discount and an additional $100 Off on top of it. Free temu Coupons { ald123454 }: Unlock Unlimited Savings! Get ready to unlock a world of savings with our free temu Coupons! We’ve got you covered with a wide range of temu Coupon code options that will help you maximize your shopping experience. $100 Off temu Coupons, Promo Codes + 25% Cash Back { ald123454 } Redeem temu Coupon Code { ald123454 }
    • Get $100 Off temu Coupon Code { ald123454 } | for new users + 30% Discount for all users You can get a $100 Off temu Coupon code using the code { ald123454 }. This temu $100 Off code is specifically for new customers and can be redeemed to receive a $100 discount on your purchase. Our exclusive temu Coupon code offers a flat $100 Off your purchase, plus an additional 30% discount. As a new temu customer, you can slash prices by up to 30% as a new temu customer using code { ald123454 }. Existing users can enjoy $100 Off their next haul with this code. But that’s not all! With our temu coupon code get up to 90% discount on select items and clearance sales. Whether you’re a new customer or an existing shopper, our temu codes provide extra discounts tailored just for you. Save up to 30% with these current temu Coupons { ald123454 } for February 2025. The latest temu coupon codes at here. Free temu codes $100 Off — { ald123454 } temu Coupon $100 Off — { ald123454 } temu Coupon $100 Off — { ald123454 } temu Memorial Day Sale 75% off — { ald123454 } temu Coupon code today — { ald123454 } temu free gift code — { ald123454 } Without inviting friends or family member  Coupon code for Canada - $100 Off— { ald123454 } temu Coupon code Australia - $100 Off— { ald123454 } temu Coupon code New Zealand - $100 Off — { ald123454 } temu Coupon code Japan -$100 Off — { ald123454 } temu Coupon code Mexico - $100 Off — { ald123454 } temu Coupon code Chile - $100 Off — { ald123454 } temu Coupon code Peru - $100 Off — { ald123454 } temu Coupon code Colombia - $100 Off — { ald123454 } temu Coupon code Malaysia - $100 Off — { ald123454 } temu Coupon code the Philippines - $100 Off — { ald123454 } temu Coupon code South Korea - $100 Off — { ald123454 } Redeem Free temu Coupon Code { ald123454 }for first time user Get $100 discount on your temu order with the promo code "acr804084". You can get a discount by clicking on the item to purchase and entering this temu Coupon code $100 Off "{ ald123454 }". temu Coupon Code { ald123454 }: Get Up To $100 Off In June 2025 Are you looking for the best temu Coupon codes to get amazing discounts? Our temu Coupons are perfect for getting those extra savings you crave. We regularly test our coupon codes for temu to ensure they work flawlessly, giving you a guaranteed discount every time. temu New User Coupon { ald123454 }: Up To 75% OFF For First-Time Users Our temu first-time user coupon codes are designed just for new customers, offering the biggest discounts and the best deals currently available on temu. To maximize your savings, download the temu Coupon For $100 Off { ald123454 }: Get A Flat $100 Discount On Order Value Get ready to save big with our incredible temu Coupon code for $100 Off! Our amazing temu $100 Off coupon code will give you a flat $100 discount on your order value, making your shopping experience even more rewarding. temu Coupon Code For $100 Off { ald123454 } For Both New And Existing Customers Our incredible temu Coupon code for $100 Off is here to help you save big on your purchases. Whether you’re a new user or an existing customer, our $100 Off code for temu will give you an additional discount! temu Coupon Bundle { ald123454 }: Flat $100 Off + Up To 30% Discount Get ready for an unbelievable deal with our temu Coupon bundle for 2025! Our temu Coupon bundles will give you a flat $100 discount and an additional $100 Off on top of it. Free temu Coupons { ald123454 }: Unlock Unlimited Savings! Get ready to unlock a world of savings with our free temu Coupons! We’ve got you covered with a wide range of temu Coupon code options that will help you maximize your shopping experience. $100 Off temu Coupons, Promo Codes + 25% Cash Back { ald123454 } Redeem temu Coupon Code { ald123454 }
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.