Equivalent Exchange 3

Equivalent Exchange 3

2M Downloads

EMC values missing on ore dictionary items

jhollowe opened this issue ยท 11 comments

commented

In my mod, I have blocks and items that use ShapelessOreRecipe and ShapedOreRecipe and EMC values do not appear for them. When I change the crafting recipes to direct recipes, it works fine. is anyone else seeing this problem, or am I doing something wrong?

commented

I have a wooden armour on my mod that has a ore dictionary recipe and the EMC value works just fine on it.
Show us the recipe and I can try and tell you if there's anything wrong with it

commented

wow... try making it simpler and adding the recipe like this:

String item = "itemNetherStar";
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(AdvancedCraft.netherStarBlock), item, item, item, item, item, item, item, item, item)):

or even:

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(AdvancedCraft.netherStarBlock), "xxx", "xxx", "xxx", 'x', "itemNetherStar")):
commented

Also, at what stage (pre init, init or post init) are you adding the recipes?

commented

I'm adding them in pre-init. btw, the reason the code is so long is i added ore dict usage after i had most of the recipes, so i just changed the main function and not each recipe. I should just use a string var instead of putting it in each time, like you said.

commented

im using a copied function from BuildCraft (in class RecipeAdder):

//From BuildCraft
public void addShapelessRecipe(ItemStack result, Object... recipe) {
            CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(result, recipe));
            //GameRegistry.addShapelessRecipe(result, recipe);
    }

and my recipe is:

RecipeAdder.addShapelessRecipe(new ItemStack(AdvancedCraft.netherStarBlock), "itemNetherStar", "itemNetherStar", "itemNetherStar", "itemNetherStar", "itemNetherStar", "itemNetherStar", "itemNetherStar", "itemNetherStar", "itemNetherStar");

and I have registered the Nether Star as:

OreDictionary.registerOre("itemNetherStar", new ItemStack(Item.netherStar));

I can craft the block, but it has no EMC. The Nether Star itself has an EMC value. I am using the most recent commit of EE (as of 1/21/14) and forge v9.11.1.965. (btw, the block of nether star is in the ore dict also.)

Picture of Problem:
crafting

thanks for the help!

commented

Did you try adding the recipe using the methods I suggested?

commented

I have tried both methods and neither work. when I change the recipe into a non ore dict recipe, it works fine.

commented

Hm.. okay so my guesses are:

  1. Make sure you are registering the item with the ore dictionary BEFORE you add the recipe
  2. try adding "before:EE3;" to your dependency
  3. try adding "after:EE3;" to your dependency

if neither of those solves it... I'll be just as lost as you are lol

commented

EE3 handles the DynEmc calculations on the WorldLoad event (https://github.com/pahimar/Equivalent-Exchange-3/blob/master/src/main/java/com/pahimar/ee3/handler/WorldEventHandler.java) but only if it hasn't been done before. This way it captures recipes registered up to that point.

It's potentially a good catch that he could be registering his OreDictionary item out of order of the recipe itself. The fact that it works when it's not an OreDictionary recipe is pretty indicative of that something is up when it is an OreDictionary recipe.

Keep trying. Also, have a look at how DynEmc does the calculations (https://github.com/pahimar/Equivalent-Exchange-3/blob/master/src/main/java/com/pahimar/ee3/emc/EmcRegistry.java#L36) - it's not as black magicky as you might think

commented

I can reproduce this error. This bug only occurs with items added to the Oredictionary by a mod(Forge-added OreDict items do work). I'll look into this.

commented

After following the recipe and it's inputs, it looks like the problem is on EE3's side. The correct recipe is added to EE3's RecipeRegisty map. I'll see if I can fix this.

EDIT: Found the problem and fixed it. EE3 wasn't checking all the ItemStacks from the OreDictionary if an OreStack was provided(it did just check if the OreStack was in the EmcMappings).