Jump to content




Java Exception Thrown

computer help java

4 replies to this topic

#1 jarifle

  • Members
  • 26 posts

Posted 27 June 2015 - 02:13 PM

Hello everyone,

I came across a little problem while writing a program that is suppost to retrieve items from my ME system using the Peripherals++ ME bridge.
It goes through the program untill it actually tries to retrieve the items (the selecting and all that works).
The error it gives is :"Java Exception Thrown: java.lang.ArrayIndexOutOfBoundsException: 1".
And thats it here is the code
local me = peripheral.wrap("back")
local s = peripheral.wrap("right")
rednet.open("top")
local function test()
  print("Enter item code please.")
  input = read()
  print("How many " .. input .. " do you want?")
  input2 = tonumber(read())
  me.retrieve(input, input2, "left")
  term.clear()
end
test()

Thank you

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 27 June 2015 - 02:32 PM

You're getting the error because the me.retrieve()'s Java-side code is crashing. Usually when a peripheral function errors out like this it's because it's being called incorrectly, and its author didn't bother to check for misuse so they could error out with a more useful message.

My best guess, based on this article, is that it's wanting you to enter a compass facing instead of just "left". It may alternatively be that it doesn't like the "item name" you're giving it (what exactly are you typing...? Odds are it's case sensitive).

#3 jarifle

  • Members
  • 26 posts

Posted 27 June 2015 - 02:39 PM

I tryed the item id and the name but if you look on the wiki of peripherals++ it says it doesnt matter. (https://github.com/a.../wiki/ME-Bridge)

Thanks for the reply

Edit: i found it you have to give in minecraft:coal for example but now my question is if you can change that?.

Edited by jarifle, 27 June 2015 - 02:41 PM.


#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 27 June 2015 - 02:56 PM

 jarifle, on 27 June 2015 - 02:39 PM, said:

Edit: i found it you have to give in minecraft:coal for example but now my question is if you can change that?.

You could make your program assume everything is to be prefixed with "minecraft:", which would allow you to type in "coal". However, this will fail if it's from a mod.

#5 jarifle

  • Members
  • 26 posts

Posted 27 June 2015 - 03:01 PM

 KingofGamesYami, on 27 June 2015 - 02:56 PM, said:

 jarifle, on 27 June 2015 - 02:39 PM, said:

Edit: i found it you have to give in minecraft:coal for example but now my question is if you can change that?.

You could make your program assume everything is to be prefixed with "minecraft:", which would allow you to type in "coal". However, this will fail if it's from a mod.

Yeah also thought of that but that would indeed screw it up but thanks for the help though.

Edit: Or is there another way to extract items from the system?

Edited by jarifle, 27 June 2015 - 03:14 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users