# 1.8.8 Inventory - size

Discussion in 'Spigot Plugin Development' started by Hunzek_, Jun 27, 2021.

1. ### Hunzek_

Hello, I'm not giving it anymore. I have inventory, there will be kits and I don't want to enter how much the inventory line will have every time.

https://ctrlv.cz/mlyD
Red color - kits
Green crosses - must be empty.

We start with 4 rows, 7 kits is still 4 rows, but if there are already 8 kits, it will be 5 rows. If there are 14 kits, then 5 lines, but if there are 15 kits, then 6 lines. Just that there are still two empty rows after the kits. There won't be much more than 21 kits. I tried to do it, I'm still stuck. Below are the codes I tried, but nothing. Maybe you understand me, I can't explain.Just a smart size inventory.

My attempts:
Code (Text):
private static List<Integer> i = Arrays.asList(6, 12, 18, 24, 30, 36);

private static Integer getRows(Integer size){

2. Attempt

if (size <= 7 && size <= 8){
Integer ex = (((size + 2) + 35) / 35 * 35) / 9;
System.out.println("" + ex);
}else if (size >= 8){
Integer ex = (((size + 4) + 35) / 35 * 35) / 9;
System.out.println("" + ex);
}else if (size == 18){
Integer ex = (((size + 6) + 35) / 35 * 35) / 9;
System.out.println("" + ex);
}else if (size == 24){
Integer ex = (((size + 8) + 35) / 35 * 35) / 9;
System.out.println("" + ex);
}else if (size == 30){
Integer ex = (((size + 10) + 35) / 35 * 35) / 9;
System.out.println("" + ex);
}else if (size == 36){
Integer ex = (((size + 12) + 35) / 35 * 35) / 9;
System.out.println("" + ex);
}

1. Attempt

/*for (int x = 0; x <= 6; x++){

Integer integer = size + x;
System.out.println("" + integer);
if (i.contains(integer)){
//System.out.println("2");
Integer ex = (((size + (integer / 2)) + 35) / 35 * 35) / 9;
return ex;
}
}*/
return 0;
}

2. ### WailRoth

You just need to do modulo (%) to calc how munch slots/row/columns you need

• Agree x 1