Posted August 9, 201411 yr For example when you craft a cake, you get the bucket back. Do IRecipe objects have a method where I can get a list of ItemStacks that are returned to your inventory or something like that? I like trains.
August 9, 201411 yr Hi CraftingManager.getInstance().getRecipeList() will give you a list of all the recipes, and you can use getRecipeOutput() on each member of the list I think this is what you're asking? -TGG
August 9, 201411 yr Author getRecipeOutput gives me an ItemStack which is the result of the craft. I want the stuff like a bucket when making cake. I like trains.
August 9, 201411 yr Hi The milk bucket is a "container item". Container items are returned to your inventory like that. So you could get a list of recipes from the CraftingManager, and inspect each ItemStack in .recipeItems for ones which have hasContainerItem(). Seems like a lot of hassle to me. What are you trying to do exactly? -TGG Item itemBucket = (new ItemBucket(Blocks.air)).setUnlocalizedName("bucket").setMaxStackSize(16).setTextureName("bucket_empty"); itemRegistry.addObject(325, "bucket", itemBucket ); itemRegistry.addObject(326, "water_bucket", (new ItemBucket(Blocks.flowing_water)).setUnlocalizedName("bucketWater").setContainerItem(itemBucket ).setTextureName("bucket_water")); itemRegistry.addObject(327, "lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(itemBucket ).setTextureName("bucket_lava")); itemRegistry.addObject(335, "milk_bucket", (new ItemBucketMilk()).setUnlocalizedName("milk").setContainerItem(itemBucket).setTextureName("bucket_milk")); Look in SlotCrafting.onPickupFromSlot to see how it is used, i.e. if (itemstack1.getItem().hasContainerItem(itemstack1)) { ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) { MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); continue; } if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { if (this.craftMatrix.getStackInSlot(i) == null) { this.craftMatrix.setInventorySlotContents(i, itemstack2); } else { this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } }
August 9, 201411 yr Author I'm the developer of the Minecraft Resource Calculator and I'm currently working on a mod that'll make adding mods to my calculator easier. The mod is currently able to save mod data, item data, oredict stuff and the conventional recipes to an SQLite database. The one thing I forgot about was processing "leftover" stuff in recipes, like buckets when making cake. So I need to add support for that. In the second code snippet you posted, itemstack1 would be a milk bucket (in the cake example) and itemstack2 would be an empty bucket. Is that right? I like trains.
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.