mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Merge pull request #3479 from FN-FAL113/fix/pedestal-bug
Fix pedestal item disappearing (fixes #3476)
This commit is contained in:
commit
c88b43717c
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@ -156,8 +157,18 @@ public class AncientAltarListener implements Listener {
|
||||
Slimefun.runSync(() -> removedItems.remove(uuid), 30L);
|
||||
|
||||
entity.remove();
|
||||
p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity));
|
||||
p.playSound(pedestal.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1F, 1F);
|
||||
|
||||
/*
|
||||
* Fixes #3476
|
||||
* Drop the item instead if the player's inventory is full and
|
||||
* no stack space left else add remaining items from the returned map value
|
||||
*/
|
||||
Map<Integer,ItemStack> remainingItemMap = p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity));
|
||||
|
||||
for (ItemStack item : remainingItemMap.values()) {
|
||||
p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), item.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user