GotoLink / RecipeHandler

Minecraft Mod to handle conflicting recipes based on MinecraftForge API
6 stars 12 forks source link

[Question] Can I get some clarification for parts of the source code please #39

Open JamesYeoman opened 4 years ago

JamesYeoman commented 4 years ago

I'm wanting to implement a way of specifying an ordered whitelist of modids. The reason for this, is that I tend to prefer the Thermal Foundation ingots and blocks, but I want to be able to fall back to Ender Core, then Mekanism, then Forestry, then whatever the mod is able to detect as a last resort. Not only this, but I want to be able to retain my ability to choose between the different conflicts in case there's a recipe that god forbid doesn't use the Ore Dictionary.

The part I need clarification for is the previousNumberOfCraft property, and the purpose of recipeIndex % previousNumberOfCraft in CraftingHandler. The name previousNumberOfCraft is an unhelpful name. There's no documentation as to what it's supposed to represent, and I can't seem to figure it out. Not only that, but I don't understand the need for recipeIndex modulo previousNumberOfCraft

Any and all clarifications will be greatly appreciated.

GotoLink commented 4 years ago

previousNumberOfCraftis the total number of recipes that match the current workbench state, which is equal to the number of conflict for said state, which is equal to the number of results.

recipeIndex is the number of time the player tried to move through recipe conflicts/results. It also maintains server/client synchronization of the selected result (in shift-click, for example).

Modulo keeps the selected recipe within previousNumberOfCraft range and provides the cycle function.

As for your goal, i would suggest looking into Forge recipe sorting system. This mod obeys the registered order of recipes.