當前位置: 首頁>>代碼示例>>Java>>正文


Java NBTTagList.get方法代碼示例

本文整理匯總了Java中net.minecraft.nbt.NBTTagList.get方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTTagList.get方法的具體用法?Java NBTTagList.get怎麽用?Java NBTTagList.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.nbt.NBTTagList的用法示例。


在下文中一共展示了NBTTagList.get方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
	
	if (compound.hasKey("RootUser")) {
		this.rootUser = compound.getString("RootUser");
	}
	
	if (compound.hasKey("Rules")) {
		NBTTagList rulesList = compound.getTagList("Rules", NBT.TAG_COMPOUND);
		this.rules = new ArrayList<Rule>();
		
		for (int i = 0, max = rulesList.tagCount(); i < max; ++i) {
			NBTTagCompound ruleNBT = (NBTTagCompound)rulesList.get(i);
			this.rules.add(new Rule(ruleNBT.getString("ID"), ruleNBT.getString("Name"), ruleNBT.getInteger("Mode")));
		}
	}
	
	if (this.rules == null || this.rules.size() == 0) {
		// Reset rules.
		this.rules = new ArrayList<Rule>();
		this.rules.add(new Rule("<machines>", Rule.MODE_OPEN));
		this.rules.add(new Rule("<players>", Rule.MODE_RESTRICTED));
	}
	
	super.readFromNBT(compound);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:27,代碼來源:SecurityServerEntity.java

示例2: readFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
	
	if (compound.hasKey("Machines")) {
		NBTTagList machineList = compound.getTagList("Machines", NBT.TAG_COMPOUND);
		
		this.connectedMachines = new ArrayList<BlockPos>();
		for (int i = 0, max = machineList.tagCount(); i < max; ++i) {
			NBTTagCompound machineNBT = (NBTTagCompound)machineList.get(i);
			this.connectedMachines.add(new BlockPos(machineNBT.getInteger("X"), machineNBT.getInteger("Y"), machineNBT.getInteger("Z")));
		}
	} else {
		this.connectedMachines = null;
	}
	
	super.readFromNBT(compound);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:18,代碼來源:RemoteShellEntity.java

示例3: getChildTag

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private static NBTBase getChildTag(NBTBase p_getChildTag_0_, String p_getChildTag_1_)
{
    if (p_getChildTag_0_ instanceof NBTTagCompound)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)p_getChildTag_0_;
        return nbttagcompound.getTag(p_getChildTag_1_);
    }
    else if (p_getChildTag_0_ instanceof NBTTagList)
    {
        NBTTagList nbttaglist = (NBTTagList)p_getChildTag_0_;
        int i = Config.parseInt(p_getChildTag_1_, -1);
        return i < 0 ? null : nbttaglist.get(i);
    }
    else
    {
        return null;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:NbtTagValue.java

示例4: getChildTag

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private static NBTBase getChildTag(NBTBase p_getChildTag_0_, String p_getChildTag_1_)
{
    if (p_getChildTag_0_ instanceof NBTTagCompound)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)p_getChildTag_0_;
        return nbttagcompound.getTag(p_getChildTag_1_);
    }
    else if (p_getChildTag_0_ instanceof NBTTagList)
    {
        NBTTagList nbttaglist = (NBTTagList)p_getChildTag_0_;

        if (p_getChildTag_1_.equals("count"))
        {
            return new NBTTagInt(nbttaglist.tagCount());
        }
        else
        {
            int i = Config.parseInt(p_getChildTag_1_, -1);
            return i < 0 ? null : nbttaglist.get(i);
        }
    }
    else
    {
        return null;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:NbtTagValue.java

示例5: getLevels

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public double getLevels() {
    NBTTagList list = ((ItemEnchantedBook) inEnchantedBook.getStackInSlot(0).getItem()).getEnchantments(inEnchantedBook.getStackInSlot(0));
    double amount = 0;
    for (int i = 0; i < list.tagCount(); ++i) {
        NBTTagCompound compound = ((NBTTagCompound) list.get(i));
        amount += EnchantmentHelper.calcItemStackEnchantability(this.world.rand, compound.getInteger("id"), compound.getShort("lvl"), inItem.getStackInSlot(0));

    }
    return amount;
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:11,代碼來源:EnchantmentAplicatorTile.java

示例6: matchesAnyChild

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private boolean matchesAnyChild(NBTBase p_matchesAnyChild_1_)
{
    if (p_matchesAnyChild_1_ instanceof NBTTagCompound)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)p_matchesAnyChild_1_;

        for (String s : nbttagcompound.getKeySet())
        {
            NBTBase nbtbase = nbttagcompound.getTag(s);

            if (this.matches(nbtbase))
            {
                return true;
            }
        }
    }

    if (p_matchesAnyChild_1_ instanceof NBTTagList)
    {
        NBTTagList nbttaglist = (NBTTagList)p_matchesAnyChild_1_;
        int i = nbttaglist.tagCount();

        for (int j = 0; j < i; ++j)
        {
            NBTBase nbtbase1 = nbttaglist.get(j);

            if (this.matches(nbtbase1))
            {
                return true;
            }
        }
    }

    return false;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:NbtTagValue.java

示例7: deserializeNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public void deserializeNBT(NBTTagCompound nbt) {
	eventFlag=nbt.getInteger("Event");
	NBTTagCompound items=nbt.getCompoundTag("Items");
	for(String key:items.getKeySet()){
		MerchantRecipeList handler=new MerchantRecipeList();
		handler.readRecipiesFromTags(items.getCompoundTag(key));
		lostItems.put(key, handler);
	}
	NBTTagList bannersS=nbt.getTagList("Banners", 9);
	for(int i=0;i<bannersS.tagCount();i++){
		NBTTagList coords=(NBTTagList) bannersS.get(i);
		banners.add(new BlockPos(coords.getIntAt(0),coords.getIntAt(1),coords.getIntAt(2)));
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:16,代碼來源:TF2EventsCommon.java


注:本文中的net.minecraft.nbt.NBTTagList.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。