Posted October 28, 20213 yr I made a custom machine in my mod alongside a custom recipe but I can't seem to get the output to update based on the input. Help would be appreciated! Here is how i am trying to implement it in my container. public void updateOutput() { List<SpiritRecipe> list = world.getRecipeManager().getRecipes(ModRecipeSerializers.SPIRIT_TYPE, inventory, world); if (list.isEmpty()) { craftResultInventory.setInventorySlotContents(0, ItemStack.EMPTY); System.out.println("List is empty"); } else { SpiritRecipe spiritRecipe = list.get(0); ItemStack itemstack = spiritRecipe.getCraftingResult(inventory); craftResultInventory.setRecipeUsed(spiritRecipe); craftResultInventory.setInventorySlotContents(0, itemstack); } } @Override public void onCraftMatrixChanged(IInventory inventoryIn) { super.onCraftMatrixChanged(inventoryIn); if (inventoryIn == inventory) { updateOutput(); } }
October 28, 20213 yr Author 9 minutes ago, diesieben07 said: Does it find the recipe? Does the recipe work properly? Have you tried using the debugger? I didn’t thought of a debugger. Ill check now. The output doesnt change so no it doesnt work properly. Are the methods written properly?
October 28, 20213 yr Author i can't seem to handle the debugger. never used it for mods. How exactly do I do it
October 28, 20213 yr Author here: https://github.com/vassdeniss/makoru-1-16-4-source Dont mind the clutter of unorganization ill get to that soon
October 28, 20213 yr Author I knew it. But isnt that called whenever something in the container is placed?
October 28, 20213 yr Author 8 minutes ago, diesieben07 said: No, you have to call it manually from your slots. Look at the vanilla crafting containers for reference. I will do that! Thank you very much for your time!
October 28, 20213 yr Author As far as i can see the onMatrixChange never gets called manually? How should I go about implementing this?
October 28, 20213 yr Author 18 minutes ago, diesieben07 said: Have you done this? No but i meant it never gets called manually in vanilla either. I presume i need to call it whenever i place an item inside?
October 28, 20213 yr Author because everytime i try to find a reference it never finds me one... Do I need to call it from the tile entity # insertItem?
October 28, 20213 yr Author 1 hour ago, diesieben07 said: Look at e.g. LoomContainer. Something like this? @Override public void onCraftMatrixChanged(IInventory inventoryIn) { ItemStack itemStack = base.getStack(); ItemStack itemStack1 = addition.getStack(); ItemStack itemStack2 = result.getStack(); if (itemStack2.isEmpty() && itemStack.isEmpty() || itemStack1.isEmpty()) { this.result.putStack(ItemStack.EMPTY); } super.onCraftMatrixChanged(inventoryIn); updateOutput(); }
October 28, 20213 yr Author From the looks of it LoomContainer still doesn't call onCraftMatrixChanged... What am i missing seriously?
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.