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