sorted
Printable View
sorted
What's going on here?
does this not return the amount already?
Code:player.getInventory().getAmount(5023)
Nah this works fine i just need to find out how to do this all command line but in reverse
if(itemId == 5022) {
int amount = 0;
for(int i = 0; i < player.getInventory().getAmount(5022); i++) {
amount++;
}
player.getInventory().delete(5022,1000000);
player.getInventory().add(5023,1);
}
this is what im trying to do but it does not want to work properly cuz even if i have 1x 5022 it will give me 1x 5023
look up the modulo operator
So you are looping a amount to check for an amount? Seems like you need to fix your logic.
Spoiler for Spoiler:
Code:for(int i = 0; i <= player.getInventory().getAmount(5022); i++) {
if (i >= 1000000) {
if (i % 1000000 == 0)
amount++;
}
}
player.getInventory().add(5023, amount);