Java Code Examples for net.minecraft.nbt.NBTTagCompound#func_150296_c()

The following examples show how to use net.minecraft.nbt.NBTTagCompound#func_150296_c() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileEssentiaCompressor.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void readCustomNBT(NBTTagCompound compound) {
    super.readCustomNBT(compound);

    this.multiblockYIndex = compound.getInteger("multiblockYIndex");
    this.isMasterTile = compound.getBoolean("isMasterTile");
    this.multiblockId = compound.getInteger("multiblockId");
    this.isMultiblockPresent = compound.getBoolean("multiblockPresent");
    this.incSize = compound.getInteger("sizeInc");
    AspectList al = new AspectList();
    NBTTagCompound cmp = compound.getCompoundTag("aspects");
    for (Object tag : cmp.func_150296_c()) {
        String strTag = (String) tag;
        int amt = cmp.getInteger(strTag);
        al.add(Aspect.getAspect(strTag), amt);
    }
    this.al = al;
}
 
Example 2
Source File: DataConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Data toNova(NBTTagCompound nbt) {
	Data data = new Data();
	if (nbt != null) {
		data.className = nbt.getString("class");
		@SuppressWarnings("unchecked")
		Set<String> keys = nbt.func_150296_c();
		keys.stream().filter(k -> k != null && !"class".equals(k)).filter(Data.ILLEGAL_SUFFIX.asPredicate().negate()).forEach(k -> data.put(k, load(nbt, k)));
	}
	return data;
}
 
Example 3
Source File: NBTHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static AspectList getAspectList(NBTTagCompound compound, String tag, AspectList defaultValue) {
    if(!compound.hasKey(tag)) return defaultValue;
    NBTTagCompound cmp = compound.getCompoundTag(tag);
    AspectList out = new AspectList();
    for (Object key : cmp.func_150296_c()) {
        String strKey = (String) key;
        Aspect a = Aspect.getAspect(strKey);
        if(a != null) {
            out.add(a, cmp.getInteger(strKey));
        }
    }
    return out;
}
 
Example 4
Source File: ItemEtherealFamiliar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static FamiliarAugment.FamiliarAugmentList getAugments(ItemStack stack) {
    if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return new FamiliarAugment.FamiliarAugmentList();
    NBTTagCompound augmentTag = NBTHelper.getData(stack).getCompoundTag("augments");
    Set<String> strKeySet = augmentTag.func_150296_c();
    if(strKeySet == null || strKeySet.size() <= 0) return new FamiliarAugment.FamiliarAugmentList();
    FamiliarAugment.FamiliarAugmentList augmentList = new FamiliarAugment.FamiliarAugmentList();
    for(String key : strKeySet) {
        FamiliarAugment augment = FamiliarAugment.getByUnlocalizedName(key);
        int level = augmentTag.getInteger(key);
        augmentList.add(new FamiliarAugment.FamiliarAugmentPair(augment, level));
    }
    return augmentList;
}
 
Example 5
Source File: MappingRegistry.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
public void scanAndTranslateStacksToRegistry(NBTTagCompound nbt) {
	// First, check if this nbt is itself a stack

	if (isStackLayout(nbt)) {
		stackToRegistry(nbt);
	}

	// Then, look at the nbt compound contained in this nbt (even if it's a
	// stack) and checks for stacks in it.
	for (Object keyO : nbt.func_150296_c()) {
		String key = (String) keyO;

		if (nbt.getTag(key) instanceof NBTTagCompound) {
			scanAndTranslateStacksToRegistry(nbt.getCompoundTag(key));
		}

		if (nbt.getTag(key) instanceof NBTTagList) {
			NBTTagList list = (NBTTagList) nbt.getTag(key);

			if (list.func_150303_d() == Constants.NBT.TAG_COMPOUND) {
				for (int i = 0; i < list.tagCount(); ++i) {
					scanAndTranslateStacksToRegistry(list.getCompoundTagAt(i));
				}
			}
		}
	}
}