Skip to content

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

Description

@fan87

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions