@Override public BaseItemStack getItemInHand(HandSide handSide) { ItemStack is = this.player.getHeldItem(handSide == HandSide.MAIN_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND); return new BaseItemStack(ItemTypes.get(ForgeRegistries.ITEMS.getKey(is.getItem()).toString())); }
public AESharedItemStack( final ItemStack itemStack ) { this.itemStack = itemStack; this.itemId = Item.getIdFromItem( itemStack.getItem() ); this.itemDamage = itemStack.getItemDamage(); }
public static int getStackItemTime(ItemStack stack) { if(stack.isEmpty()) return 0; if(stack.getItem() == Item.getItemFromBlock(Blocks.SAND)) return stack.getItemDamage() == 1 ? 200 : 20; if(stack.getItem() == Item.getItemFromBlock(Blocks.SOUL_SAND)) return 1200; if(stack.getItem() == ModItems.manaResource) return 1; return 0; }
private static IStorageCell<?> getStorageCell( final ItemStack input ) { if( input != null ) { final Item type = input.getItem(); if( type instanceof IStorageCell ) { return (IStorageCell<?>) type; } } return null; }
public static boolean isItemBlacklistedFromMagnet(ItemStack stack, int recursion) { if(recursion > 5) return false; if(stack.getItemDamage() != Short.MAX_VALUE) { ItemStack copy = new ItemStack(stack.getItem(), 0, Short.MAX_VALUE); boolean general = isItemBlacklistedFromMagnet(copy, recursion + 1); if(general) return true; } String key = getMagnetKey(stack); return magnetBlacklist.contains(key); }
@Override public boolean collideBurst(IManaBurst burst, RayTraceResult pos, boolean isManaBlock, boolean dead, ItemStack stack) { EntityThrowable entity = (EntityThrowable) burst; dead = getLens(stack.getItemDamage()).collideBurst(burst, entity, pos, isManaBlock, dead, stack); ItemStack compositeLens = getCompositeLens(stack); if(!compositeLens.isEmpty() && compositeLens.getItem() instanceof ILens) dead = ((ILens) compositeLens.getItem()).collideBurst(burst, pos, isManaBlock, dead, compositeLens); return dead; }
private ModelResourceLocation getMesh( ItemStack itemStack ) { // If the stack has no color, don't use the colored model since the impact of calling getColor for every quad is // extremely high, // if the stack tries to re-search its inventory for a new paintball everytime AEColor col = ( (ToolColorApplicator) itemStack.getItem() ).getActiveColor( itemStack ); return ( col != null ) ? MODEL_COLORED : MODEL_UNCOLORED; }
public static String stackToString(ItemStack stack, boolean forceIgnore) { if(stack.isEmpty()) return "NULL"; if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider) return ((IRecipeKeyProvider) stack.getItem()).getKey(stack); return stack.getTranslationKey() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage()); }
@Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { if(!stack.isEmpty() && stack.getItem() == ModItems.sparkUpgrade) return super.insertItem(slot, stack, simulate); else return stack; } };
@Override public void apply(ItemStack stack, BurstProperties props) { int storedColor = getStoredColor(stack); if(storedColor != -1) props.color = getLensColor(stack); getLens(stack.getItemDamage()).apply(stack, props); ItemStack compositeLens = getCompositeLens(stack); if(!compositeLens.isEmpty() && compositeLens.getItem() instanceof ILens) ((ILens) compositeLens.getItem()).apply(compositeLens, props); }
public OrechidRecipeWrapper(Map.Entry<String, Integer> entry) { this.weight = entry.getValue(); final int amount = Math.max(1, Math.round((float) weight * 64 / getTotalOreWeight())); // Shouldn't ever return an empty list since the ore weight // list is filtered to only have ores with ItemBlocks List<ItemStack> stackList = OreDictionary.getOres(entry.getKey()).stream() .filter(s -> s.getItem() instanceof ItemBlock) .map(ItemStack::copy) .collect(Collectors.toList()); stackList.forEach(s -> s.setCount(amount)); outputStacks = Collections.singletonList(stackList); }
@Override public Item getItem() { final ItemStack is = this.getTextureItem(); if( is.isEmpty() ) { return Items.AIR; } return is.getItem(); }
@Override public double getCharge( ItemStack stack ) { final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem(); return (int) PowerUnits.AE.convertTo( PowerUnits.EU, poweredItem.getAECurrentPower( stack ) ); }
public static boolean doesOreExist(String key) { return OreDictionary.doesOreNameExist(key) && OreDictionary.getOres(key).stream() .anyMatch(s -> s.getItem() instanceof ItemBlock); }
void buildEntries() { entriesToDisplay.clear(); ILexicon lex = (ILexicon) stackUsed.getItem(); for(LexiconEntry entry : category == null ? BotaniaAPI.getAllEntries() : category.entries) { if(entry.isVisible() && lex.isKnowledgeUnlocked(stackUsed, entry.getKnowledgeType()) && matchesSearch(entry)) entriesToDisplay.add(entry); } Collections.sort(entriesToDisplay); }
@Override public ItemStack asItemStackRepresentation() { ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).orElse( ItemStack.EMPTY ); if( !is.isEmpty() ) { FluidDummyItem item = (FluidDummyItem) is.getItem(); item.setFluidStack( is, this.getFluidStack() ); return is; } return ItemStack.EMPTY; }
@Override public ICellInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel channel ) { if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) && !is.isEmpty() && is .getItem() instanceof ItemCreativeStorageCell ) { return CreativeCellInventory.getCell( is ); } return null; }
@SubscribeEvent public void leftClick(PlayerInteractEvent.LeftClickEmpty evt) { if (!evt.getItemStack().isEmpty() && evt.getItemStack().getItem() == this) { PacketHandler.sendToServer(new PacketLeftClick()); } }