当前位置: 首页>>代码示例>>Java>>正文


Java NBTTagCompound.getTagList方法代码示例

本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.getTagList方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.getTagList方法的具体用法?Java NBTTagCompound.getTagList怎么用?Java NBTTagCompound.getTagList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.nbt.NBTTagCompound的用法示例。


在下文中一共展示了NBTTagCompound.getTagList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);

	NBTTagList list = compound.getTagList("playerList", 10);
	isGameLive = compound.getBoolean("isGameLive");

	players.clear();
	UUID uuid;

	for (int i = 0; i < list.tagCount(); i++) {
		uuid = getUUIDFromTag(list.getCompoundTagAt(i));

		if (worldObj != null && worldObj.playerEntities != null) {
			for (EntityPlayer player : (List<EntityPlayer>) worldObj.playerEntities) {
				if (player.getGameProfile().getId() == uuid) {
					players.add(uuid);
					break;
				}
			}
		}
	}
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:24,代码来源:LobbyTileEntity.java

示例2: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    NBTTagList nbttaglist = compound.getTagList("Items", 10);
    this.brewingItemStacks = new ItemStack[this.getSizeInventory()];

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot");

        if (j >= 0 && j < this.brewingItemStacks.length)
        {
            this.brewingItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
    }

    this.brewTime = compound.getShort("BrewTime");

    if (compound.hasKey("CustomName", 8))
    {
        this.customName = compound.getString("CustomName");
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:TileEntityBrewingStand.java

示例3: load

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Load inventory data from NBT tag
 * @param inventory Target inventory
 * @param tag tag to load
 * @param seed Loading seed
 */
private static void load(IInventory inventory, NBTTagCompound tag, long seed) {
    if (tag == null || !Configurator.NATIVE_LOOT) {
        return;
    }
    Random random = new Random(seed);
    NBTTagList items = tag.getTagList("Items", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < items.tagCount() && i < inventory.getSizeInventory(); ++i) {
        NBTTagCompound stackTag = items.getCompoundTagAt(i);
        String itemName = stackTag.getString("id").replaceAll(".*:", "");
        itemName = itemName.isEmpty() ? String.valueOf(stackTag.getShort("id")) : itemName;
        Pattern iPattern = Pattern.compile(Pattern.quote(itemName), Pattern.CASE_INSENSITIVE);
        UItem item = Utils.select(UItems.items.select(iPattern), random.nextLong());
        byte count = items.getCompoundTagAt(i).getByte("Count");
        int damage = items.getCompoundTagAt(i).getShort("Damage");
        int slot = stackTag.hasKey("Slot", Constants.NBT.TAG_BYTE) ? stackTag.getByte("Slot") : i;
        slot = (slot < 0 || slot >= inventory.getSizeInventory()) ? i : slot;
        if (item != null && count > 0 && UItems.getPossibleMeta(item).contains(damage)) {
            inventory.setInventorySlotContents(slot, new UItemStack(item, count, damage).getItemStack());
        }
    }
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:28,代码来源:Tiles.java

示例4: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound tagCompound) {
	super.tileEntityReadFromNBT(tagCompound);
	NBTTagList tagList = tagCompound.getTagList("Items", 3);
	machineItemStacks = new ItemStack[getSizeInventory()];

	for(int i = 0; i < tagList.tagCount(); ++i) {
		NBTTagCompound tagCompund1 = tagList.getCompoundTagAt(i);
		byte b = tagCompund1.getByte("Slot");
		if(b >= 0 && b < machineItemStacks.length)
			machineItemStacks[b] = ItemStack.loadItemStackFromNBT(tagCompund1);
	}
	currentEnergy = tagCompound.getShort("CurrentEnergy");

	if(tagCompound.hasKey("CustomName", 8)) {
		machineName = tagCompound.getString("CustomName");
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:18,代码来源:TileEntityAutoWorkBench.java

示例5: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    NBTTagList nbttaglist = compound.getTagList("Items", 10);
    this.inventory = new ItemStack[this.getSizeInventory()];

    if (compound.hasKey("CustomName", 8))
    {
        this.customName = compound.getString("CustomName");
    }

    this.transferCooldown = compound.getInteger("TransferCooldown");

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot");

        if (j >= 0 && j < this.inventory.length)
        {
            this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:TileEntityHopper.java

示例6: RemoteLayout

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public RemoteLayout(ItemStack remote, int guiLeft, int guiTop) {
    NBTTagCompound tag = remote.getTagCompound();
    if (tag != null) {
        NBTTagList tagList = tag.getTagList("actionWidgets", 10);
        for (int i = 0; i < tagList.tagCount(); i++) {
            NBTTagCompound widgetTag = tagList.getCompoundTagAt(i);
            String id = widgetTag.getString("id");
            Class<? extends ActionWidget> clazz = registeredWidgets.get(id);
            try {
                ActionWidget widget = clazz.newInstance();
                widget.readFromNBT(widgetTag, guiLeft, guiTop);
                actionWidgets.add(widget);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:RemoteLayout.java

示例7: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    NBTTagList list = compound.getTagList("Items", 10);
    for (int i = 0; i < list.tagCount(); ++i) {
        NBTTagCompound stackTag = list.getCompoundTagAt(i);
        int slot = stackTag.getByte("Slot") & 255;
        this.setInventorySlotContents(slot, new ItemStack(compound));
    }

    if (compound.hasKey("CustomName", 8)) {
        this.setCustomName(compound.getString("CustomName"));
    }
}
 
开发者ID:inifire201,项目名称:MagicWinds,代码行数:15,代码来源:TileEntityTrinketMaker.java

示例8: readStructureFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
protected void readStructureFromNBT(NBTTagCompound tagCompound, TemplateManager p_143011_2_)
{
    super.readStructureFromNBT(tagCompound, p_143011_2_);
    NBTTagList nbttaglist = tagCompound.getTagList("Entrances", 11);

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        this.roomsLinkedToTheRoom.add(new StructureBoundingBox(nbttaglist.getIntArrayAt(i)));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:StructureMineshaftPieces.java

示例9: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.inGround = tagCompund.getByte("inGround") == 1;

    if (tagCompund.hasKey("direction", 9))
    {
        NBTTagList nbttaglist = tagCompund.getTagList("direction", 6);
        this.motionX = nbttaglist.getDoubleAt(0);
        this.motionY = nbttaglist.getDoubleAt(1);
        this.motionZ = nbttaglist.getDoubleAt(2);
    }
    else
    {
        this.setDead();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:33,代码来源:EntityFireball.java

示例10: readRecipiesFromTags

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readRecipiesFromTags(NBTTagCompound compound)
{
    NBTTagList nbttaglist = compound.getTagList("Recipes", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        this.add(new MerchantRecipe(nbttagcompound));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:MerchantRecipeList.java

示例11: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound tagCompound)
{
    super.readFromNBT(tagCompound);

    if (tagCompound.hasKey("Processed", 9))
    {
        NBTTagList nbttaglist = tagCompound.getTagList("Processed", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            this.processed.add(new ChunkPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Z")));
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:StructureOceanMonument.java

示例12: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
	this.moistureLevel = nbt.getFloat("moisture");
	for (NBTBase tag : nbt.getTagList("nutrientData", NBT.TAG_COMPOUND))
	{
		NBTTagCompound tagCompound = (NBTTagCompound) tag;
		this.nutrientData.put(EnumPlantNutrient.values()[tagCompound.getByte("key")], tagCompound.getFloat("value"));
	}
	
	if (nbt.hasKey("calendar"))
	{
		this.timeKeeper.deserializeNBT((NBTTagLong) nbt.getTag("calendar"));
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:16,代码来源:ExPFarmland.java

示例13: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound)
{
	if(compound.hasKey("links"))
	{
		NBTTagList linktags = compound.getTagList("links", 10);
		for(int i = 0; i < linktags.tagCount(); i++)
		{
			NBTTagCompound com = linktags.getCompoundTagAt(i);
			links.add(NodeLink.fromNBT(com));
		}
	}
	items.deserializeNBT(compound.getCompoundTag("items"));
	super.readFromNBT(compound);
}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:16,代码来源:TileEntityLinkableWorker.java

示例14: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.baseColor = compound.getInteger("Base");
    this.patterns = compound.getTagList("Patterns", 10);
    this.patternList = null;
    this.colorList = null;
    this.patternResourceLocation = null;
    this.field_175119_g = true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:TileEntityBanner.java

示例15: readCustomNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readCustomNBT(NBTTagCompound tag) {
	
	NBTTagList taglist = tag.getTagList(UCStrings.TAG_BEATLIST, 10);
	for (int i = 0; i < taglist.tagCount(); i++) {
		NBTTagCompound tag2 = taglist.getCompoundTagAt(i);
		Note tagnote = Note.values()[tag2.getInteger(UCStrings.TAG_NOTE)];
		Instrument taginst = Instrument.values()[tag2.getInteger(UCStrings.TAG_INST)];
		Octave tagoct = Octave.values()[tag2.getInteger(UCStrings.TAG_OCT)];
		long tagtime = tag2.getLong(UCStrings.TAG_TIME);
		this.setNote(tagnote, taginst, tagoct, tagtime);
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:14,代码来源:TileMusicaPlant.java


注:本文中的net.minecraft.nbt.NBTTagCompound.getTagList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。