Commits
Parker Hawke authored and md_5 committed e850144b070
241 241 | public int firstEmpty() { |
242 242 | ItemStack[] inventory = getStorageContents(); |
243 243 | for (int i = 0; i < inventory.length; i++) { |
244 244 | if (inventory[i] == null) { |
245 245 | return i; |
246 246 | } |
247 247 | } |
248 248 | return -1; |
249 249 | } |
250 250 | |
251 + | |
252 + | public boolean isEmpty() { |
253 + | return inventory.isEmpty(); |
254 + | } |
255 + | |
251 256 | public int firstPartial(Material material) { |
252 257 | Validate.notNull(material, "Material cannot be null"); |
253 258 | material = CraftLegacy.fromLegacy(material); |
254 259 | ItemStack[] inventory = getStorageContents(); |
255 260 | for (int i = 0; i < inventory.length; i++) { |
256 261 | ItemStack item = inventory[i]; |
257 262 | if (item != null && item.getType() == material && item.getAmount() < item.getMaxStackSize()) { |
258 263 | return i; |
259 264 | } |
260 265 | } |