Closed Minerofmillions closed 3 weeks ago
Thanks for reporting!
The command doesn't work unfortunately. The paste operation seems to be limited by 256 characters. With command blocks, I can't seem to get it working either. Do you have a smaller operation to reproduce the issue with? An Integrated Scripting snippet would also work.
How odd. The function function reducer(a, b) { return choice(a > b, a, b) }
works as a reduction operator over numbers (with the global definition of choice), but the equivalent operator (reducer = pipe2(greaterThan, pipe(flip(choice), flip), apply(pipe2, identity))
) doesn't. Both of them do, however, give the maximum of two applied numbers.
The second image shows the values I'm using to test with, the third image shows the functions that I'm testing along with the two different tests. The middle column is apply2(func, 5, 10)
while the right column is reduce1(func, list)
.
Forgot to mention, this test was Minecraft 1.20.1, Forge 47.3.7, ID 1.23.3, InScr 1.0.4
On the one hand, good news the scripting approach works. But on the other hand, this makes debugging a lot more difficult of course.
Issue type:
Short description:
A custom
maxByItemSize
operator (Item -> Item -> Item
) gives the correct results when applying two items to it, but when using it with reduce1 on an item list, it errors with "The property is expected to output Item, while Operator was found for operator Virtual Piped 2 Operator."Steps to reproduce the problem:
data modify block <Chest Coordinates> Items[0].tag.value set value {serializer: "integrateddynamics:combined.pipe2", value: {operators: [{v: {serializer: "integrateddynamics:combined.pipe",value: {operators: [{v: {serializer: "integrateddynamics:combined.pipe",value: {operators: [{v: "integrateddynamics:itemstack_size"}, {v: "integrateddynamics:relational_gt"}]}}}, {v: {serializer: "integrateddynamics:curry",value: {baseOperator: "integrateddynamics:operator_pipe",values: [{value: "integrateddynamics:itemstack_size",valueType: "integrateddynamics:operator"}]}}}]}}},{v: {serializer: "integrateddynamics:combined.pipe",value: {operators: [{v: {serializer: "integrateddynamics:combined.flip",value: {operators: [{v: "integrateddynamics:general_choice"}]}}}, {v: "integrateddynamics:operator_flip"}]}}},{v: {serializer: "integrateddynamics:curry",value: {baseOperator: "integrateddynamics:operator_pipe2",values: [{value: "integrateddynamics:general_identity",valueType: "integrateddynamics:operator"}]}}}]}}
4a. Alternatively, make the operator as described on Discord and apply itemSize.Item -> Operator
Expected behaviour:
reduce1(maxByItemSize, itemList)
should return the item from the list with the highest stack size, taking the last if there are multiple.Versions:
Also tested with