cn.nukkit.inventory.BeaconInventory Maven / Gradle / Ivy
package cn.nukkit.inventory;
import cn.nukkit.Player;
import cn.nukkit.item.Item;
import cn.nukkit.level.Position;
/**
* @author Rover656
*/
public class BeaconInventory extends FakeBlockUIComponent {
public BeaconInventory(PlayerUIInventory playerUI, Position position) {
super(playerUI, InventoryType.BEACON, 27, position);
}
@Override
public void onClose(Player who) {
super.onClose(who);
Item[] drops = who.getInventory().addItem(this.getItem(0));
for (Item drop : drops) {
if (!who.dropItem(drop)) {
this.getHolder().getLevel().dropItem(this.getHolder().add(0.5, 0.5, 0.5), drop);
}
}
this.clear(0);
}
}