Xhamolk / XACT

Xhamolk's Advanced Crafting Table. Inspired by Eloraam mod's RP2 and it's Project Table.
http://www.minecraftforum.net/topic/1551715-xact-xhamolk-s-advanced-crafting-table/
11 stars 5 forks source link

bug with RP2's special (microblock) recipes #53

Closed Xhamolk closed 11 years ago

Xhamolk commented 11 years ago

Seems Elo uses the same IRecipe object for all the stages of the microblock recipes. For instance, having a slab would produce a panel, and a panel would produce a cover. This happens when you have the recipe to cut a block into panels.

Also, for some strange reason.. I end up with far too many covers. The saw is depleted before this is done with the 64 blocks.

Xhamolk commented 11 years ago

For clarification, this will cut the first valid block on the inventory. Doesn't matter if the recipe says wood, it might cut cobble if it's the first slot (or any slot prior to wood).

Xhamolk commented 11 years ago

All microblock recipes are handled by the same IRecipe object. The material is deducted when the items are placed on the grid.

This behavior on the RP2 side tricks my check for ingredients on the Crafting Handler: https://github.com/Xhamolk/XACT/blob/master/xact/xk/xact/api/CraftingHandler.java#L401

I need to figure out a way to prevent this from happening.

Xhamolk commented 11 years ago

The solution would be to check if the IRecipe is special, which implies the output varies according to the items on the grid. Note: changing output's NBT should not be considered in this catergory, nor changes to the damage value if the item doesn't have sub types.

To fix this issue, I could have a list of IRecipe subclasses that have this sort of behavior, and check that before line 401. However, i'm not entirely convinced with this approach, because it's not fully expandable.

Xhamolk commented 11 years ago

I've decided to enforce last comment's approach. A recipe will be considered special if the output varies depending on the ingredients.This variation will be determined if the ID of the real output differs from the nominal output's. Additionally, if the nominal output has sub-types, the difference in metadata/damage will also be taken into account.

In the case of special recipes: To determine if an item is an ingredient, it will be replaced on the grid and the recipe's output must match the nominal output.

Xhamolk commented 11 years ago

Make sure this doesn't break support for IC2's recipes.

Edit: works fine.