so again looking @ code , found this.
public prototableshapedrecipe addrecipe(itemstack stack, object ... varargs){ int = 0; ... ... ... string[] astring = (string[])((string[])varargs[i++]); }
the thing wondering why there need 2 casts of string[] , when comes passing variable i
varargs[]
considered value 1 , making i
1 or adding 1 i
when being passed , i
stays @ 0.
in reverse order, first i
value used in array index (so varargs[0]
) , i
incremented on next line i
1
.
next, because varargs
or type object[]
. it's safe use cast if takes string[]
(s) (and forgot opening {
). like
public prototableshapedrecipe addrecipe(itemstack stack, string[]... varargs) { int = 0; // ... string[] astring = varargs[i++]; // <-- varargs[0] // = 1 }
Comments
Post a Comment