本文整理匯總了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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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)));
}
}