@Override public int hashCode() { return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTagCompound() ? this.itemStack.getTagCompound() : 0 ); }
@Override public boolean hasTagCompound() { return this.getDefinition().hasTagCompound(); }
private void markItemAs( final int slotIndex, final ItemStack i, final TestStatus b ) { if( b == TestStatus.TEST || i.hasTagCompound() ) { return; } ( b == TestStatus.ACCEPT ? this.passCache : this.failCache ).add( new TestLookup( slotIndex, i ) ); }
@Nonnull public static String getSubtype(ItemStack stack) { return stack.hasTagCompound() ? ItemNBTHelper.getString(stack, TAG_BREW_KEY, "none") : "none"; }
public static String getType(ItemStack stack) { return stack.hasTagCompound() ? ItemNBTHelper.getString(stack, SubTileEntity.TAG_TYPE, "") : ""; }
public FluidStack getFluidStack( ItemStack is ) { if( is.hasTagCompound() ) { NBTTagCompound tag = is.getTagCompound(); return FluidStack.loadFluidStackFromNBT( tag ); } return null; }
@Override public int getStoredDimensionID( final ItemStack is ) { if( is.hasTagCompound() ) { final NBTTagCompound c = is.getTagCompound(); return c.getInteger( NBT_CELL_ID_KEY ); } return -1; }
public void onPlacement( final ItemStack stack, final EntityPlayer player, final EnumFacing side ) { if( stack.hasTagCompound() ) { this.uploadSettings( SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound() ); } }
/** Gets the NBTTagCompound in an ItemStack. Tries to init it * previously in case there isn't one present **/ public static NBTTagCompound getNBT(ItemStack stack) { if(!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound()); return stack.getTagCompound(); }
public Bounds( final ItemStack stack, final FuzzyMode fuzzy, final boolean ignoreMeta ) { Preconditions.checkState( !stack.isEmpty(), "ItemStack#isEmpty() has to be false" ); Preconditions.checkState( stack.getCount() == 1, "ItemStack#getCount() has to be 1" ); final NBTTagCompound tag = stack.hasTagCompound() ? stack.getTagCompound() : null; this.lower = this.makeLowerBound( stack, tag, fuzzy, ignoreMeta ); this.upper = this.makeUpperBound( stack, tag, fuzzy, ignoreMeta ); }
@SubscribeEvent(priority = EventPriority.HIGHEST) public static void onTooltipEvent(ItemTooltipEvent event) { if(event.getItemStack().hasTagCompound() && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false)) event.getToolTip().add(I18n.format("botaniamisc.hasKeepIvy")); }
@Override public boolean matches(@Nonnull InventoryCrafting var1, @Nonnull World var2) { boolean foundIvy = false; boolean foundItem = false; for(int i = 0; i < var1.getSizeInventory(); i++) { ItemStack stack = var1.getStackInSlot(i); if(!stack.isEmpty()) { if(stack.getItem() == ModItems.keepIvy) foundIvy = true; else if(!foundItem && !(stack.hasTagCompound() && ItemNBTHelper.getBoolean(stack, ItemKeepIvy.TAG_KEEP, false)) && !stack.getItem().hasContainerItem(stack)) foundItem = true; else return false; } } return foundIvy && foundItem; }
public NetworkToolViewer( final ItemStack is, final IGridHost gHost ) { this.is = is; this.gh = gHost; this.inv = new AppEngInternalInventory( this, 9 ); this.inv.setFilter( new NetworkToolInventoryFilter() ); if( is.hasTagCompound() ) // prevent crash when opening network status screen. { this.inv.readFromNBT( Platform.openNbtData( is ), "inv" ); } }
public void populateDropStackNBTs(List<ItemStack> drops) { if(isPassiveFlower() && ticksExisted > 0 && BotaniaAPI.internalHandler.getPassiveFlowerDecay() > 0) { ItemStack drop = drops.get(0); if(!drop.isEmpty()) { if(!drop.hasTagCompound()) drop.setTagCompound(new NBTTagCompound()); NBTTagCompound cmp = drop.getTagCompound(); cmp.setInteger(TAG_PASSIVE_DECAY_TICKS, passiveDecayTicks); } } }
private boolean compareStacks(ItemStack recipe, ItemStack supplied) { if(recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage()) { //check that the user supplied nbt tag is a superset of the recipe item nbt tag //if the recipe doesn't have an NBT tag, the user supplied one doesn't matter, it is a superset if(!recipe.hasTagCompound()) return true; //if the recipe does have an NBT tag but the user supplied doesn't, also no way it's a superset if(!supplied.hasTagCompound()) return false; NBTTagCompound mergedNBT = supplied.getTagCompound().copy(); mergedNBT.merge(recipe.getTagCompound()); return supplied.getTagCompound().equals(mergedNBT); } return false; }
@Override public WorldCoord getStoredSize( final ItemStack is ) { if( is.hasTagCompound() ) { final NBTTagCompound c = is.getTagCompound(); return new WorldCoord( c.getInteger( NBT_SIZE_X_KEY ), c.getInteger( NBT_SIZE_Y_KEY ), c.getInteger( NBT_SIZE_Z_KEY ) ); } return new WorldCoord( 0, 0, 0 ); }
public ItemBlockPool(Block par2Block) { super(par2Block); addPropertyOverride(new ResourceLocation(LibMisc.MOD_ID, "full"), (stack, worldIn, entityIn) -> { boolean renderFull = stack.getItemDamage() == PoolVariant.CREATIVE.ordinal() || stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull"); return renderFull ? 1F : 0F; }); }
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()); }
static int getProgress( final ItemStack is ) { if( is.hasTagCompound() ) { return is.getTagCompound().getInteger( "progress" ); } else { final int progress; final NBTTagCompound comp = Platform.openNbtData( is ); comp.setInteger( "progress", progress = is.getItemDamage() ); is.setItemDamage( ( is.getItemDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET ); return progress; } }
@Override public ItemStack getCraftingResult(InventoryCrafting var1) { ItemStack out = output.copy(); for (int i = 0; i < var1.getSizeInventory(); i++) { ItemStack stack = var1.getStackInSlot(i); if (!stack.isEmpty() && stack.getItem() instanceof ItemArmor && stack.hasTagCompound()) { EnchantmentHelper.setEnchantments(EnchantmentHelper.getEnchantments(stack), out); if(Botania.thaumcraftLoaded) HelmRevealingRecipe.copyTCData(stack, out); break; } } return out; } }