Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] Custom Furnace recipe


Recommended Posts

Vanila Furnace Recipe is working fine...i was using same methods to re-create Recipe but different outputs.

 

When i put ironOre it should give me back IronDust.

but no smelting is occurring like it dose not see recipe. Like it dose not exist.

this is entire class.

package com.vladan899.MachinesRecpie;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import net.minecraft.block.Block;
import net.minecraft.block.BlockStoneBrick;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFishFood;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;

import com.google.common.collect.Maps;
import com.vladan899.blocks.BlockList;
import com.vladan899.items.ItemList;

public class SmasherRecpie {
 private static final SmasherRecpie smeltingBase = new SmasherRecpie();
    private Map smeltingList = Maps.newHashMap();
    private Map experienceList = Maps.newHashMap();

    public static SmasherRecpie instance()
    {
        return smeltingBase;
    }

    private SmasherRecpie()
    {
        this.addSmeltingRecipeForBlock(Blocks.iron_ore, new ItemStack(ItemList.IronDust), 0.7F);
        this.addSmeltingRecipeForBlock(Blocks.gold_ore, new ItemStack(ItemList.GoldDust), 1.0F);
        this.addSmeltingRecipeForBlock(BlockList.OreCopper, new ItemStack(ItemList.CopperDust), 1.0F);
        this.addSmeltingRecipeForBlock(BlockList.OreSilver, new ItemStack(ItemList.SilverDust), 1.0F);
        this.addSmeltingRecipeForBlock(BlockList.OreTin, new ItemStack(ItemList.TinDust), 1.0F);
       

    }

    public void addSmeltingRecipeForBlock(Block input, ItemStack stack, float experience)
    {
        this.addSmelting(Item.getItemFromBlock(input), stack, experience);
    }

    public void addSmelting(Item input, ItemStack stack, float experience)
    {
        this.addSmeltingRecipe(new ItemStack(input, 1, 32767), stack, experience);
    }

    public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience)
    {
        this.smeltingList.put(input, stack);
        this.experienceList.put(stack, Float.valueOf(experience));
    }

    public ItemStack getSmeltingResult(ItemStack stack)
    {
        Iterator iterator = this.smeltingList.entrySet().iterator();
        Entry entry;

        do
        {
            if (!iterator.hasNext())
            {
                return null;
            }

            entry = (Entry)iterator.next();
        }
        while (!this.compareItemStacks(stack, (ItemStack)entry.getKey()));

        return (ItemStack)entry.getValue();
    }

    private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
    {
        return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata());
    }

    public Map getSmeltingList()
    {
        return this.smeltingList;
    }

    public float getSmeltingExperience(ItemStack stack)
    {
        float ret = stack.getItem().getSmeltingExperience(stack);
        if (ret != -1) return ret;

        Iterator iterator = this.experienceList.entrySet().iterator();
        Entry entry;

        do
        {
            if (!iterator.hasNext())
            {
                return 0.0F;
            }

            entry = (Entry)iterator.next();
        }
        while (!this.compareItemStacks(stack, (ItemStack)entry.getKey()));

        return ((Float)entry.getValue()).floatValue();
    }
}

Link to post
Share on other sites

1. your code formatting is a total mess and nearly unreadable.

2. you just copied vanilla code and hoped that itll work.

 

private boolean canSmelt() {

        if (this.Total_slots[0] == null)
        {
            return false;
        }
        else
        {
            ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.Total_slots[0]);
            if (itemstack == null) return false;
            if (this.Total_slots[2] == null) return true;
            if (!this.Total_slots[2].isItemEqual(itemstack)) return false;
            int result = Total_slots[2].stackSize + itemstack.stackSize;
            return result <= getInventoryStackLimit() && result <= this.Total_slots[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly.
        }
}

you want to use ur custom recipes, but you are chjecking for FurnaceRecipes.

Link to post
Share on other sites

I do not know how or where to register Custom recipe? Where do i do that?

And no i didn't use vanila recipe...

i used from this site....as tutorial.

http://jabelarminecraft.blogspot.com/p/minecraft-modding-containers.html

 

And there i do not see any requirements to register custom recipe.

Link to post
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.

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

    • What I've been trying to do is I have been attempting to implement an item that can create a transparent blue layer around the entire player. I am using Curios' API for this, as the item is meant to be an equippable accessory. There are also other accessories I have implemented to the mod using the API. I have been able to implement everything that handles this rendering with the accessory item, however I've become stuck after running into a specific issue: when the transparent blue layer is active, it will prevent any accessories specifically on the player's arms from rendering. As far as I can tell, this only happens with the accessories on the player's arms (such as the gloves or even Curios' template knuckles item), as accessories rendering on the player's body for some reason render just fine under the transparent layer. Images for better context: I have been at this for quite awhile but haven't able to figure out what is causing this issue, especially since the inconsistency between rendering for body parts has made me even more confused. It could be a Curios issue, but nothing in its accessory layer code exactly stands out as a cause (if it is indeed Curios' fault though it would at least be good to know what the issue is to pass on to the mod dev). The pendant and glove accessories both render with the same RenderType and render buffer, which I duplicated based on the vanilla armor layer's choices for that, as the vanilla armor layer is also immune to the transparency issue on the arm model part: The relevant code for items and renderers can be found below: Pendants: - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/pendant/PendantItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/PendantModel.java Gloves: - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/gloves/GlovesItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/GlovesModel.java Repulsion Shield (the item creating the transparency layer): - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/misc/RepulsionShieldItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/RepulsionShieldModel.java and, if necessary, Curios' Accessory Layer (code not mine, obviously): - https://github.com/TheIllusiveC4/Curios/blob/1.16.x-forge/src/main/java/top/theillusivec4/curios/client/render/CuriosLayer.java Any help would be appreciated, as I've run out of ideas for what could be causing this issue and how I could fix it. I can provide more information if needed.
    • Ok that's fair. But it's still terrible.
    • Really old Minecraft versions are no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Ah sorry, you're right. I can refer you to the way Lycanites renders all of their .obj model entities, and best of all it's up to date for 1.16, but it is pretty complicated than just your standard java model. Depending on what you're doing it might not be worth it... https://gitlab.com/Lycanite/LycanitesMobs/-/tree/master/src/main/java/com/lycanitesmobs/client
    • wasn't TEST for item stacks, or tile entities? I know I have to extend an EntityRenderer, but I don't know how to get an obj to render from there
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.