Jump to content

(SOLVED) Need help with recipe returning


RedBullSlurpie

Recommended Posts

So for my mod, I have added some custom food. Example I've added Apple Juice. For the shapeless recipe I have for crafting apple juice is a Blender, and an Apple, which works with 1 problem. I want the blender to be returned to me after crafting the apple juice so it only takes the apple, without needing to craft another blender, how can I do this? I am fairly good at understanding coding, sometimes just gets a bit confusing, especially when it's something I do not know how to do. Thanks everyone who takes the time to read this and help me out.

Link to comment
Share on other sites

What you want is the container item system.

 

For simple items that don't use metadata/NBT, call

Item#setContainerItem

to set the

Item

that will replace the item when it's consumed in a crafting recipe.

 

For more complex items or custom logic, override

Item#hasContainerItem(ItemStack)

to return

true

when the item has a container item and

Item#getContainerItem(ItemStack)

to return the

ItemStack

that will replace the item when it's consumed in a crafting recipe.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Item#hasContainerItem(ItemStack) / Item#getContainerItem(ItemStack) are part of the blender.  The blender tells the crafting table that its container item stack is itself.  This isn't a recipe thing, this is an ingredient thing.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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
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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Issue with giacomos_foundry, check you have the latest version then contact the mod author.
    • Heya, so i was running atm8 through curseforge end of last year and connecting to servers fine, i have recently returned to it and now i cant login into the authentication servers no matter what i try. everything is updated and running fine i just cant login to authenticate.  i can run normal vanilla minecraft and go into servers fine with no issues it just seems to be the atm8 auth issue.  here is my latest log file im hoping someone can help me figure out what is causing this issue or give me some things to try as ive tried multiple things on several sites but nothing has fixed the issue. my internet connect is fine i have no issues with anything apart from this game, my friend who lives 15mins drive from me in the same state of Australia can get it working on his pc but i cant seem to. any advice would be great this has frustrated me greatly. i can provide more of the logs if required 19:42:23.342 [19:42:23] [Render thread/INFO] [mojang/YggdrasilAuthenticationService]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' 19:42:28.554 [19:42:28] [Render thread/ERROR] [minecraft/Minecraft]: Failed to verify authentication 19:42:28.554 com.mojang.authlib.exceptions.AuthenticationException: com.mojang.authlib.exceptions.MinecraftClientException: Failed to read from https://api.minecraftservices.com/player/attributes due to Connect timed out 19:42:28.554 at com.mojang.authlib.exceptions.MinecraftClientException.toAuthenticationException(MinecraftClientException.java:28) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.554 at com.mojang.authlib.yggdrasil.YggdrasilUserApiService.fetchProperties(YggdrasilUserApiService.java:159) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.554 at com.mojang.authlib.yggdrasil.YggdrasilUserApiService.<init>(YggdrasilUserApiService.java:55) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.554 at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.createUserApiService(YggdrasilAuthenticationService.java:161) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.555 Caused by: com.mojang.authlib.exceptions.MinecraftClientException: Failed to read from https://api.minecraftservices.com/player/attributes due to Connect timed out 19:42:28.555 at com.mojang.authlib.minecraft.client.MinecraftClient.readInputStream(MinecraftClient.java:93) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.555 at com.mojang.authlib.minecraft.client.MinecraftClient.get(MinecraftClient.java:48) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.555 at com.mojang.authlib.yggdrasil.YggdrasilUserApiService.fetchProperties(YggdrasilUserApiService.java:129) ~[authlib-3.11.49.jar%23122!/:?] {}
    • i dont really know what happened pls help the report is in the spoiler
    • Quick update on this. I tried to setup Forge locally to made the change myself, but ran into some issues described here (which I hope to fix, so any help would be much appreciated). So I did something different: I cloned the MutableHashedLinkedMap inside my project and then "clone" the vanilla map entries to my object. Inside my object I removed the null assignments and that seems to fix the issue. If I remove all paintings and then iterate over the leftover entries the breakpoint inside the check for a painting is never hit, which is what I expect. If I apply a filter to exclude only the modded variants, the breakpoint is hit only for the vanilla ones. So it seems that is just that null assignments on both previous and next that breaks the iterator. This is how I debugged using my own local class   if(tab.equals(CreativeModeTabs.FUNCTIONAL_BLOCKS)) { org.blazers.MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility> test = new org.blazers.MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility>(ItemStackLinkedSet.TYPE_AND_TAG); event.getEntries().forEach(entry -> test.put(entry.getKey(), entry.getValue())); var iterator = test.iterator(); ArrayList<ItemStack> itemsToRemove = new ArrayList<>(); while (iterator.hasNext()) { ItemStack stack = iterator.next().getKey(); if(stack.is(Items.PAINTING)) { itemsToRemove.add(stack); } } itemsToRemove.forEach(test::remove); var iterator2 = test.iterator(); while (iterator2.hasNext()) { ItemStack stack = iterator2.next().getKey(); if(stack.is(Items.PAINTING)) { LOG.info(stack + " " + stack.getOrCreateTag()); } } } I'm submitting a PR now that I know that removing those null assignments fixes this, hopefully that's really what it needs to solve it
    • i created a modpack for 1.12.2 with about 60 mods and im using the same forge 1.12.2 and optifine. I only have this problem that every time I start the game with optifine in the loading stage "Loading Initializing Minecraft Engine (3/7)" "Rendering Setup - Loading Model Manager (3/5) 1/1) "the game simply freezes and continues the loading process extremely slowly, taking 40 minutes to finish and return the normal loading process and if I interact with anything else or click on the game it stops responding and does not load anymore. I have tried reinstalling forge, reinstalling java, reinstalling minecraft itself and nothing has seemed to fix this issue. my pc specs are: Intel Core i5-4210U Intel HD Graphics 4400 12GB DDR3 Memory HDD 256GB Please help as i want to play with this modpack Latest log: https://pastebin.com/D61sVWGU
  • Topics

×
×
  • Create New...

Important Information

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