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

I get an array error after one click #20

Open
Jark5455 opened this issue Jul 6, 2018 · 4 comments
Open

I get an array error after one click #20

Jark5455 opened this issue Jul 6, 2018 · 4 comments

Comments

@Jark5455
Copy link

Jark5455 commented Jul 6, 2018

console output after one click in game

Exception in thread java.lang.ArrayIndexOutOfBoundsException: 1203
at TerrariaClone.updateApp(TerrariaClone.java:3283)
at TerrariaClone$1$1.actionPerformed(TerrariaClone.java:2119)
at javax.swing.Timer.fireActionPerformed(Timer.java:313)
at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

@raxod502
Copy link
Member

raxod502 commented Jul 6, 2018

It's not a bug, it's a feature; please refer to the README:

Unfortunately, it's only working in the academic sense, since it's so slow that you only get about 0.03 FPS and it crashes when you click the mouse button. But, somewhere in there is a working game. You know, sort of.

@voidnull000
Copy link

I don't think there is a working game in this anywhere, so we must destroy it.

@Jark5455
Copy link
Author

With a little bit of work and debugging, I found the error. On TerrariaCClone line 3929
if (blocks[layer][uy][ux] != 0 && Arrays.asList(BLOCKTOOLS.get(blocks[layer][uy][ux])).contains(inventory.tool())) {

The issue is that on the array the array limit for "uy" is 192 yet you are asking for a number off the array,1202, could you have made a mistake and meant to type 120

@Jark5455
Copy link
Author

Jark5455 commented Oct 21, 2018

fixed, replace 3690-3691 with this
if ((layer < blocks.length && uy < blocks[layer].length && ux < blocks[layer][uy].length) && blocks[layer][uy][ux] >= 8 && blocks[layer][uy][ux] <= 14 || blocks[layer][uy][ux] == 17 || blocks[layer][uy][ux] == 23 || blocks[layer][uy][ux] >= 80 && blocks[layer][uy][ux] <= 82) {
this breaks the physics of the game but you can atleast right click
to be able to use your tools, replace 3363 with this
if ((layer < blocks.length && uy < blocks[layer].length && ux < blocks[layer][uy].length) &&
but you cannot break blocks
I still have not found out why the character cannot move

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

No branches or pull requests

3 participants