Cleanup: Use 0-sized arrays and fix division

This commit is contained in:
Phoenix616 2023-03-01 17:54:31 +01:00
parent e6a2d2f1c5
commit 0d8d37eb85
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 3 additions and 3 deletions

View File

@ -351,7 +351,7 @@ public class InventoryUtil {
itemList.add(item.clone());
}
return itemList.toArray(new ItemStack[itemList.size()]);
return itemList.toArray(new ItemStack[0]);
}
/**
@ -413,7 +413,7 @@ public class InventoryUtil {
stackedItems.add(item.clone());
continue;
}
for (int i = 0; i < Math.floor(item.getAmount() / maxStackSize); i++) {
for (int i = 0; i < Math.floor((double) item.getAmount() / maxStackSize); i++) {
ItemStack itemClone = item.clone();
itemClone.setAmount(maxStackSize);
stackedItems.add(itemClone);
@ -424,6 +424,6 @@ public class InventoryUtil {
stackedItems.add(rest);
}
}
return stackedItems.toArray(new ItemStack[stackedItems.size()]);
return stackedItems.toArray(new ItemStack[0]);
}
}