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

Casting AngledLocation to Vector3D #20

Open
Alf21 opened this issue Dec 10, 2017 · 1 comment
Open

Casting AngledLocation to Vector3D #20

Alf21 opened this issue Dec 10, 2017 · 1 comment

Comments

@Alf21
Copy link
Contributor

Alf21 commented Dec 10, 2017

[15:36:38][ERROR][err] Caused by: java.lang.ClassCastException: [Ljava.lang.Obje
ct; cannot be cast to [Lnet.gtaun.shoebill.data.Vector3D;

This error occurs everytime I try to cast an ArrayList to a Vector3D[] array after adding a Location (player.getLocation()); to the ArrayList

example:

ArrayList<Vector3D> controlPoints = new ArrayList<>();
controlPoints.add((Vector3D) player.getLocation());

and then

Vector3D[] tmp = (Vector3D[]) controlPoints.toArray();
@Alf21
Copy link
Contributor Author

Alf21 commented Dec 11, 2017

I solved it with this code

Vector3D[] tmp = new Vector3D[controlPoints.size()];
for (int i = 0; i < tmp.length; i++) {
    tmp[i] = controlPoints.get(i);
}

or

Vector3D[] tmp = new Vector3D[arrayList.size()];
tmp = arrayList.toArray(tmp);

So something is in trouble with the kotlin changes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant