
Multiple modifiers for single upgrade
sainagh opened this issue ยท 6 comments
In base Modular Machinery the following JSON field would work to give multiple modifiers to one block machine upgrade, but in MMCE it only considers the first modifier, making it impossible to create upgrades that affect multiple aspects of a recipe.
If the following upgrade is added to a machine JSON, it will recognize the upgrade in the preview, but once the block is switched, the error 'no valid recipe' shows up in the controller GUI, and it prevents the machine from working.
"modifiers": [
{
"elements": "contenttweaker:mythic_coil_t2@0",
"x": 0,
"y": 3,
"z": 1,
"description": "Multiplies amounts processed by 16",
"modifiers": [{
"io": "output",
"target": "modularmachinery:item",
"operation": 1,
"multiplier": 16
},
{
"io": "input",
"target": "modularmachinery:item",
"operation": 1,
"multiplier": 16
}]
}
],
I checked my mechanisms, working with the usual modifiers at first glance has been corrected and everything is working normally. However, the problem with addItemModifier remained(
I figured I would add onto this with a bit more context. It seems to have broke in r46.
For an example, let's say we have a recipe 1 iron ore -> 1 iron dust
.
In older versions, the above modifiers would result in 16 iron ore -> 16 iron dust
. Now, consider the following scenarios for r46 and up:
a) Machine has modifier of only output
with multiplier
16: 1 iron ore -> 16 iron dust
, as expected.
b) Machine has modifier of only input
with multiplier
16: The recipe will not work, saying "Missing input item!"
c) Machine has both modifiers: Same issue as b).
d) Machine has both modifiers, but internal parallelism is set to 16: 1 iron ore -> 16 iron dust
, but you must have at least 16 iron ore in the input hatch(es).
e) Machine has both modifiers, but internal parallelism is set to 32: 2 iron ore -> 32 iron dust
, still need 16 iron ore in the hatches, but can process 2 at a time.
So the output modifier works fine, but the input one does not. I don't believe it is an issue with the order of modifiers.
To summarize the bug/change in behavior in newer MMCE versions:
- OLD: Consume
multiplier
amount ofinput
to producemultiplier
amount ofoutput
- NEW: You must have at least
multiplier
amount ofinput
for the machine to run (same as OLD), then consume up toinput * (parallelism / multiplier)
(whereinput
is the original amount, not themultiplier
amount) to producemultiplier
amount ofoutput
.
As such, the new behavior seems very odd where it depends on the ratio between parallelism and the multiplier
modifier.
Perhaps I should add some more consequences of the changes in r46. Namely, related to the operation of the "addItemModifier" method.
I have this code:
var count = 8; var modifiedCount = 9; recipe.addItemOutput(<minecraft:dirt> * count).addItemModifier(function(ctrl as IMachineController, item as IItemStack) as IItemStack { return item * modifiedCount; }
OLD RESULT: item * modifiedCount
. That is, the original amount of the item from the recipe itself (minecraft:dirt * count) was not used.
NEW RESULT: item * count * modifiedCount
. Here, the ItemStack that the method returns is additionally multiplied by the original amount of the item in the recipe.
The bottom line is that the new logic of the method is very inconvenient from the point of view of controlling the number of items. After all, now you need to take into account the initial multiplier of items specified in the recipe. Yes, you can specify it as 1, but then there will be an ugly display in the JEI for this item.
Some of the strange behavior mentioned above should be fixed in this commit, no problems in my own testing, but for security reasons I would like someone to test this fix.
Commit: e1cdbe3
Actions: https://github.com/NovaEngineering-Source/ModularMachinery-Community-Edition/actions/runs/6839871622