Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API Bug] Incorrect document and error message of ModifierRotate #110

Open
fan87 opened this issue May 5, 2022 · 0 comments
Open

[API Bug] Incorrect document and error message of ModifierRotate #110

fan87 opened this issue May 5, 2022 · 0 comments
Labels

Comments

@fan87
Copy link

fan87 commented May 5, 2022

Describe the bug
Please check To Reproduce

In which environment did the Bug appear?
Server-side, but it will appear in every environment

To Reproduce
Incorrect Error Message: Pass 3 arguments to ModifierRotate.set somehow, 4 will be fine, 2, 1, or 0 will return false and an error message, but 3 throws an exception. It should also return false and an error message instead of throwing an exception
Incorrect document: Somehow get a ModifierRotate object, then tostring the method set, it shows function(Double:x, Double:y, Double:z):boolean -- sets new values, but it should be function(Double:deg, Double:x, Double:y, Double:z):boolean -- sets new values

Expected behavior
Please check To Reproduce

Minecraft:

  • Mod Version (e.g. OpenGlasses-MC1.12.2-2.2)
  • Minecraft Version (e.g. Minecraft 1.12)
  • Forge Version (e.g. Forge 14.23.5.2779)

Additional context
In the sourcecode of ModifierRotate.java:

    @Callback(doc = "function(Double:x, Double:y, Double:z):boolean -- sets new values", direct = true)
    public Object[] set(Context context, Arguments args){
        if(!args.isDouble(0) || !args.isDouble(1) || !args.isDouble(2))
            return new Object[]{ false, "4 values(Double) required! deg, x,y,z" };

        get().update(new float[]{ (float) args.checkDouble(0), (float) args.checkDouble(1), (float) args.checkDouble(2), (float) args.checkDouble(3) });

        markDirty();
        return new Object[]{ true };
    }

It seems to be requiring 4 doubles, but the doc only has 3, and the argument check (the check that returns false and the error message) only checks first 3 arguments.

@ben-mkiv ben-mkiv added the bug label May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants