예제 #1
0
 @Override
 public void setItemInHand(ItemStack stack) {
   Hotbar hotbar = this.getHandle().getHotbar();
   Optional<Slot> slot = hotbar.getSlot(new SlotIndex(hotbar.getSelectedSlotIndex()));
   if (slot.isPresent()) {
     slot.get().set(ItemStackConverter.of(stack));
   }
 }
예제 #2
0
 @Override
 public ItemStack getItemInHand() {
   Hotbar hotbar = this.getHandle().getHotbar();
   Optional<Slot> slot = hotbar.getSlot(new SlotIndex(hotbar.getSelectedSlotIndex()));
   if (slot.isPresent()) {
     Optional<org.spongepowered.api.item.inventory.ItemStack> stack = slot.get().peek();
     if (stack.isPresent()) {
       return ItemStackConverter.of(stack.get());
     }
   }
   return null;
 }