final ItemStack hand = player.inventory.getCurrentItem(); this.who = player;
public void activate( final EntityPlayer player ) { if( !Platform.hasPermissions( new DimensionalCoord( this ), player ) ) { return; } final ItemStack myItem = this.inv.getStackInSlot( 0 ); if( myItem.isEmpty() ) { ItemStack held = player.inventory.getCurrentItem(); if( AEApi.instance().definitions().materials().certusQuartzCrystal().isSameAs( held ) || Platform.isChargeable( held ) ) { held = player.inventory.decrStackSize( player.inventory.currentItem, 1 ); this.inv.setStackInSlot( 0, held ); } } else { final List<ItemStack> drops = new ArrayList<>(); drops.add( myItem ); this.inv.setStackInSlot( 0, ItemStack.EMPTY ); Platform.spawnDrops( this.world, this.pos.offset( this.getForward() ), drops ); } }
if( Platform.isWrench( player, player.inventory.getCurrentItem(), te.getPos() ) )
@Override public void detectAndSendChanges() { final ItemStack currentItem = this.getPlayerInv().getCurrentItem(); if( currentItem != this.toolInv.getItemStack() ) { if( !currentItem.isEmpty() ) { if( ItemStack.areItemsEqual( this.toolInv.getItemStack(), currentItem ) ) { this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() ); } else { this.setValidContainer( false ); } } else { this.setValidContainer( false ); } } super.detectAndSendChanges(); }
private boolean useMemoryCard( final EntityPlayer player ) final ItemStack memCardIS = player.inventory.getCurrentItem();
/** * Allows the item switching in "battlemode", delegates to parent method if in normal mode * @return the currently selected {@link ItemStack} */ @Override public ItemStack getCurrentItem() { return isBattlemode() ? extraItems[currentItem - OFFSET] : super.getCurrentItem(); }
@Override public void detectAndSendChanges() { final ItemStack currentItem = this.getPlayerInv().getCurrentItem(); if( currentItem != this.toolInv.getItemStack() ) { if( !currentItem.isEmpty() ) { if( ItemStack.areItemsEqual( this.toolInv.getItemStack(), currentItem ) ) { this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() ); } else { this.setValidContainer( false ); } } else { this.setValidContainer( false ); } } if( this.isValidContainer() ) { final NBTTagCompound data = Platform.openNbtData( currentItem ); this.setFacadeMode( data.getBoolean( "hideFacades" ) ); } super.detectAndSendChanges(); }
@Override public boolean processInteract(@Nonnull EntityPlayer player, @Nonnull EnumHand hand) { ItemStack itemstack = player.inventory.getCurrentItem(); if (itemstack.getItem() == Items.SPAWN_EGG) { return super.processInteract(player, hand); } return false; }
@Override public void detectAndSendChanges() final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot( this.slot );
final ItemStack it = player.inventory.getCurrentItem(); if( !it.isEmpty() && it.getItem() instanceof IGuiItem )
if( stem ) it = player.inventory.getCurrentItem();
if( stem ) it = player.inventory.getCurrentItem();
@Override public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) final ItemStack is = player.inventory.getCurrentItem(); final IItems items = AEApi.instance().definitions().items(); final IComparableDefinition maybeMemoryCard = items.memoryCard();
public static boolean isPlayerUsingWrench(EntityPlayer player) { if (player == null) return false; if (Eln.playerManager.get(player).getInteractEnable()) return true; ItemStack stack = player.inventory.getCurrentItem(); if (stack == null) return false; return isWrench(stack); }
if( inv != null && playerInventory.getCurrentItem() == stack )
@Override public void onContainerClosed(EntityPlayer player) { ItemStack stack = this.inventory.getCurrentItem(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBag) { ItemDrill.writeSlotsToNBT(this.bagInventory, this.inventory.getCurrentItem()); NBTTagCompound compound = stack.getTagCompound(); this.filter.writeToNBT(compound, "Filter"); compound.setBoolean("AutoInsert", this.autoInsert); } super.onContainerClosed(player); }
/** * Patch over {@link EntityPlayer#getItemStackFromSlot(EntityEquipmentSlot)}, adapted for the dual wielding */ public static ItemStack getItemStackFromSlot(EntityPlayer player, EntityEquipmentSlot slot){ if(slot == EntityEquipmentSlot.MAINHAND) return player.inventory.getCurrentItem(); else if(slot == EntityEquipmentSlot.OFFHAND) return ((InventoryPlayerBattle)player.inventory).getCurrentOffhandWeapon(); else if(slot.getSlotType() == EntityEquipmentSlot.Type.ARMOR) return player.inventory.armorInventory.get(slot.getIndex()); return ItemStack.EMPTY; }
@ExposeProperty public StructWrapper currentItem() { final InventoryPlayer inventory = player().inventory; return StructWrapper.create(new ItemStackWrapper(inventory.getCurrentItem())); } }
@Override public boolean onPartShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos ) final ItemStack is = player.inventory.getCurrentItem(); if( !is.isEmpty() && is.getItem() instanceof IMemoryCard )
@Override public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack stack = player.inventory.getCurrentItem(); if (!getEntityWorld().isRemote && isStick(stack) && getLarvaType() != 4) { setLarvaSize(getLarvaSize() + 0.1F); stack.shrink(1); return true; } return super.processInteract(player, hand); }