Jump to content

Recommended Posts

Posted

Hey there, just a quick suggestion (with code that works, just needs to be officially implemented). The ore dictionary recipes should check for a special interface and see if an item that could be different (NBT) from one time to the next to see if it is a potential match for a recipe. The code I have here works:

 

The interface:

public interface IOreDictionary
{
public String getOreName(ItemStack stack);
}

This is to be implemented by Item subclasses that need to have special behavior with ore recipes.

 

In ShapedOreRecipe and ShapelessOreRecipe, there is this line in the checkMatch() method:

matched = matched || checkItemEquals(item, slot);

This simply needs changed to:

matched = matched || checkIOreMatch(item, slot) || checkItemEquals(item, slot);

 

And the method checkIOreMatch() that does all the work (this can be public static somewhere):

private boolean checkIOreMatch(ItemStack target, ItemStack input)
    {
    	if(input == null || target == null)
    	{
    		return false;
    	}
    	if(!(input.getItem() instanceof IOreDictionary))
    	{
    		return false;
    	}
    	int oreID = OreDictionary.getOreID(target);
    	if(oreID != -1)
    	{
    		String name = OreDictionary.getOreName(oreID);
    		boolean ret = name.equals("Unknown") ? false : ((IOreDictionary)input.getItem()).getOreName(input).equals(name);
    		return ret;
    	}
    	return false;
    }

 

Basically, if the item has special cases (might be "ingotIron" at one time and "logWood" another) it will still match, regardless of whether or not it is actually registered.

 

That is all, here's to hoping this becomes official!

Posted

It's not about conserving space, it's (more or less) for my mods and mods like them. I have a basic setup that allows for an unlimited number of alloys, and I figured it would be nice to be able to tell the game when my ingots are in the form of Steel Ingots versus when they are in the form of a Bronze Ingot, or when they are just in an undetermined mixture. They use NBT data so it's not currently possible to check for that.

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



×
×
  • Create New...

Important Information

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