public static NBTTagList getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) { return verifyExistance(stack, tag) ? getNBT(stack).getTagList(tag, objtype) : nullifyOnFail ? null : new NBTTagList(); }
public InvalidPatternHelper( final ItemStack is ) { final NBTTagCompound encodedValue = is.getTagCompound(); if( encodedValue == null ) { throw new IllegalArgumentException( "No pattern here!" ); } final NBTTagList inTag = encodedValue.getTagList( "in", 10 ); final NBTTagList outTag = encodedValue.getTagList( "out", 10 ); this.isCrafting = encodedValue.getBoolean( "crafting" ); this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" ); for( int i = 0; i < outTag.tagCount(); i++ ) { this.outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) ); } for( int i = 0; i < inTag.tagCount(); i++ ) { NBTTagCompound in = inTag.getCompoundTagAt( i ); // skip empty slots in the crafting grid if( in.hasNoTags() ) { continue; } this.inputs.add( new PatternIngredient( in ) ); } }
public PacketJEIRecipe( final ByteBuf stream ) throws IOException { final ByteArrayInputStream bytes = this.getPacketByteArray( stream ); bytes.skip( stream.readerIndex() ); final NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes ); if( comp != null ) { this.recipe = new ItemStack[9][]; for( int x = 0; x < this.recipe.length; x++ ) { final NBTTagList list = comp.getTagList( "#" + x, 10 ); if( list.tagCount() > 0 ) { this.recipe[x] = new ItemStack[list.tagCount()]; for( int y = 0; y < list.tagCount(); y++ ) { this.recipe[x][y] = new ItemStack( list.getCompoundTagAt( y ) ); } } } } }
final NBTTagList inTag = encodedValue.getTagList( "in", 10 ); final NBTTagList outTag = encodedValue.getTagList( "out", 10 ); this.isCrafting = encodedValue.getBoolean( "crafting" );
private boolean itemStackMatchesSearchTerm( final ItemStack itemStack, final String searchTerm ) { if( itemStack.isEmpty() ) { return false; } final NBTTagCompound encodedValue = itemStack.getTagCompound(); if( encodedValue == null ) { return false; } // Potential later use to filter by input // NBTTagList inTag = encodedValue.getTagList( "in", 10 ); final NBTTagList outTag = encodedValue.getTagList( "out", 10 ); for( int i = 0; i < outTag.tagCount(); i++ ) { final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) ); if( !parsedItemStack.isEmpty() ) { final String displayName = Platform .getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) ) .toLowerCase(); if( displayName.contains( searchTerm ) ) { return true; } } } return false; }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) { if(stack.getTagCompound() != null && stack.getTagCompound().hasKey(TAG_ITEMS)) { NBTTagList oldData = stack.getTagCompound().getTagList(TAG_ITEMS, Constants.NBT.TAG_COMPOUND); IItemHandler newInv = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(newInv, null, oldData); stack.getTagCompound().removeTag(TAG_ITEMS); if(stack.getTagCompound().getSize() == 0) stack.setTagCompound(null); } }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) { if(stack.getTagCompound() != null && stack.getTagCompound().hasKey(TAG_ITEMS)) { NBTTagList oldData = stack.getTagCompound().getTagList(TAG_ITEMS, Constants.NBT.TAG_COMPOUND); IItemHandler newInv = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(newInv, null, oldData); stack.getTagCompound().removeTag(TAG_ITEMS); if(stack.getTagCompound().getSize() == 0) stack.setTagCompound(null); } }
NBTTagList nbttaglist = nbttagcompound.getTagList("Pos", 6); World world = logic.getSpawnerWorld(); int j = nbttaglist.tagCount();
public void readFromNBT( final NBTTagCompound data ) { this.waitingToSend = null; final NBTTagList waitingList = data.getTagList( "waitingToSend", 10 ); if( waitingList != null ) { for( int x = 0; x < waitingList.tagCount(); x++ ) { final NBTTagCompound c = waitingList.getCompoundTagAt( x ); if( c != null ) { final ItemStack is = new ItemStack( c ); this.addToSendList( is ); } } } this.craftingTracker.readFromNBT( data ); this.upgrades.readFromNBT( data, "upgrades" ); this.config.readFromNBT( data, "config" ); this.patterns.readFromNBT( data, "patterns" ); this.storage.readFromNBT( data, "storage" ); this.priority = data.getInteger( "priority" ); this.cm.readFromNBT( data ); this.readConfig(); this.updateCraftingList(); }
@Override public void readFromNBT(NBTTagCompound tag) { if (tag.hasKey(NBT_DISKS)) { this.disksTag = tag.getTagList(NBT_DISKS, Constants.NBT.TAG_COMPOUND); this.canReadDisks = true; } }
final NBTTagList list = data.getTagList( "tasks", 10 ); for( int x = 0; x < list.tagCount(); x++ )
public void readFromNBT(NBTTagCompound nbt) { isInWhitelist = nbt.getBoolean("Whitelist"); CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(inventory, null, nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND)); }
@Override public Things read(Registry registry, Set<NBTAction> phase, NBTTagCompound nbt, Type type, String name, @Nullable Things object) throws IllegalArgumentException, IllegalAccessException, InstantiationException, NoHandlerFoundException { object = new Things(); NBTTagList list = nbt.getTagList(name, 8); for (int i = 0; i < list.tagCount(); i++) { object.add(list.getStringTagAt(i)); } return object; } }
@Override public void read(NBTTagCompound tag) { super.read(tag); if (tag.hasKey(NBT_COVERS)) { coverManager.readFromNbt(tag.getTagList(NBT_COVERS, Constants.NBT.TAG_COMPOUND)); } }
@Override public void readFromNBT(@Nonnull NBTTagCompound nbtRoot) { signalColors.clear(); NBTTagCompound t = nbtRoot.getCompoundTag("filterType"); type = EnumSignalFilterType.values()[t.getInteger("type")]; NBTTagList tagList = nbtRoot.getTagList("signalColors", nbtRoot.getId()); for (int i = 0; i < tagList.tagCount(); i++) { signalColors.add(DyeColor.fromIndex(tagList.getCompoundTagAt(i).getInteger("color"))); } }
@Override public void read(NBTTagCompound tag) { super.read(tag); StackUtils.readItems(upgrades, 1, tag); if (tag.hasKey(NBT_COVERS)) { coverManager.readFromNbt(tag.getTagList(NBT_COVERS, Constants.NBT.TAG_COMPOUND)); } }
@Override public void readFromNBT(@Nonnull NBTTagCompound nbtRoot) { isBlacklist = NbtValue.FILTER_BLACKLIST.getBoolean(nbtRoot); clear(); NBTTagList tagList = nbtRoot.getTagList("fluids", nbtRoot.getId()); for (int i = 0; i < tagList.tagCount(); i++) { fluids[i] = FluidStack.loadFluidStackFromNBT(tagList.getCompoundTagAt(i)); } }
@Override public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); setActive(nbttagcompound.getBoolean("Active")); NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10); for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); pendingSpawns.add(new ItemStack(nbttagcompound1)); } }
@Override public void read(NBTTagCompound tag) { super.read(tag); if (tag.hasKey(NBT_CHANNEL)) { channel = tag.getString(NBT_CHANNEL); } if (tag.hasKey(NBT_COVERS)) { coverManager.readFromNbt(tag.getTagList(NBT_COVERS, Constants.NBT.TAG_COMPOUND)); } }
public static void readFromNBT(NBTTagCompound nbt, String str, IInventory inventory) { NBTTagList var2 = nbt.getTagList(str, 10); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); int var5 = var4.getByte("Slot") & 255; if (var5 >= 0 && var5 < inventory.getSizeInventory()) { inventory.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4)); } } }