mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Merge pull request #2347 from OmerBenGera/patch-1
Fixed CargoNetworkTask not checking for other slots before dropping i…
This commit is contained in:
commit
17e324fc88
@ -108,11 +108,18 @@ class CargoNetworkTask implements Runnable {
|
|||||||
Inventory inv = inventories.get(inputTarget.getLocation());
|
Inventory inv = inventories.get(inputTarget.getLocation());
|
||||||
|
|
||||||
if (inv != null) {
|
if (inv != null) {
|
||||||
|
// Check if the original slot hasn't been occupied in the meantime
|
||||||
if (inv.getItem(previousSlot) == null) {
|
if (inv.getItem(previousSlot) == null) {
|
||||||
inv.setItem(previousSlot, stack);
|
inv.setItem(previousSlot, stack);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), stack);
|
// Try to add the item into another available slot then
|
||||||
|
ItemStack rest = inv.addItem(stack).get(0);
|
||||||
|
|
||||||
|
if (rest != null) {
|
||||||
|
// If the item still couldn't be inserted, simply drop it on the ground
|
||||||
|
inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), rest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user