LlamaLad7/MixinExtras

[Question]How do I modify these two (or more) as a whole?

Closed this issue · 6 comments

Here's a snippet of code I found

if (pos.getY() >= world.getSeaLevel()) {
            // .........
        }

How do I use @ModifyExpressionValue to make it look like this

if (myboolean() && (pos.getY() >= world.getSeaLevel()) ) {
            // .........
        }

ModifyExpressionValue the getSeaLevel call, and if you want to force the comparison to false then return Integer.MAX_VALUE

thank

Although you could also use Float.NaN

Although you could also use Float.NaN

That is not the case. NaN cannot be represented as an integer and ModifyExpressionValue does not allow changing the datatype of a value (as instructions after the expression expect the datatype to be an integer still).

Although you could also use Float.NaN

That is not the case. NaN cannot be represented as an integer and ModifyExpressionValue does not allow changing the datatype of a value (as instructions after the expression expect the datatype to be an integer still).

I just checked and you are right both are values of type int, I assumed that the "getY()" method was of type float or double

Note that once MixinExtras gets its expression injection point, you will be able to simply target the whole expression directly, which should make situations like this easier