Jump to content

issues using getAmount() method


vladbuff

Recommended Posts

Trying to make my 1st script and having issues identifying an amount of item in my inventory by the ID.  I read the API and found the getAmount() method but I cant seem to properly pass it the correct parameters. Ive been able to get it to successfully take the correct item ID (I think) but I cant seem to get it to interact with the correct container.

	long copperAmount = 0;
	
	public long getAmount(int... ids){
		return copperAmount;
	}

	public final String copperOreAmount(final long ms){
    	long amt = getAmount(436);
   		return String.format("%02d", amt);
}	

I have code in my onPaint() that prints out the result of copperAmount that looks like this to debug the results

g.drawString(copperOreAmount(getAmount()), 300, 300);

It will only print out 0 even though I have the item in my inventory and i'm worried that my print statement may be incorrect or that i may be inputting the parameters of getAmount() incorrectly or if my return statement is incorrect or something im missing entirely. ive also tried typing it is Inventory.getAmount() to ensure it was pulling from the inventory container and not just interacting with nothing but it gave me an error about a static method interacting with a non static method but when i made everything static it would just throw the same error.

Edited by vladbuff
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...