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


Java NBTTagList.getIntAt方法代碼示例

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


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

示例1: readFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	if (compound.hasKey("Attributes")) {
		NBTTagCompound attrs = compound.getCompoundTag("Attributes");
		NBTTagList attrList = (NBTTagList) compound.getTag("AttributesList");
		for (String key : attrs.getKeySet())
			this.attributes.put(TF2Attribute.attributes[Integer.parseInt(key)], attrs.getInteger(key));
		for (int i = 0; i < attrList.tagCount(); i++)
			this.attributeList[i] = TF2Attribute.attributes[attrList.getIntAt(i)];
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:13,代碼來源:TileEntityUpgrades.java

示例2: HarshenTemplate

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
protected HarshenTemplate(ResourceLocation location) {
	String s = location.getResourceDomain();
       String s1 = location.getResourcePath();
       InputStream stream = null;
       boolean flag;
       try
       {
       	stream = getClass().getResourceAsStream("/assets/" + HarshenCastle.MODID + "/structures/" + s1 + ".nbt");
           NBTTagCompound compound = CompressedStreamTools.readCompressed(stream);
           if (!compound.hasKey("DataVersion", 99))
           {
           	compound.setInteger("DataVersion", 500);
           }
           Template template = new Template();
           DataFixer fixer;
           try
           {
           	fixer = Minecraft.getMinecraft().getDataFixer();
           }
           catch (Throwable e) {
			fixer = FMLServerHandler.instance().getDataFixer();
		}
           template.read(fixer.process(FixTypes.STRUCTURE, compound));
           this.blocks.clear();
           NBTTagList nbttaglist = compound.getTagList("size", 3);
           this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
           NBTTagList nbttaglist4 = compound.getTagList("pos", 3);
           if(nbttaglist4.hasNoTags())
           	this.pos = BlockPos.ORIGIN;
           else
               this.pos = new BlockPos(nbttaglist4.getIntAt(0), nbttaglist4.getIntAt(1), nbttaglist4.getIntAt(2));
           BasicPalette template$basicpalette = new BasicPalette();
           NBTTagList nbttaglist1 = compound.getTagList("palette", 10);

           for (int i = 0; i < nbttaglist1.tagCount(); ++i)
           {
               template$basicpalette.addMapping(NBTUtil.readBlockState(nbttaglist1.getCompoundTagAt(i)), i);
           }

           NBTTagList nbttaglist3 = compound.getTagList("blocks", 10);
           for (int j = 0; j < nbttaglist3.tagCount(); ++j)
           {
               NBTTagCompound nbttagcompound = nbttaglist3.getCompoundTagAt(j);
               NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
               BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
               IBlockState iblockstate = template$basicpalette.stateFor(nbttagcompound.getInteger("state"));
               NBTTagCompound nbttagcompound1;

               if (nbttagcompound.hasKey("nbt"))
               {
                   nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
               }
               else
               {
                   nbttagcompound1 = null;
               }

               if(!(iblockstate.getBlock() instanceof BlockStructure))
               	this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
           }
       }
       catch (Throwable var10)
       {
       }
       finally
       {
           IOUtils.closeQuietly(stream);
       }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:70,代碼來源:HarshenTemplate.java

示例3: read

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void read(NBTTagCompound compound)
{
    this.blocks.clear();
    this.entities.clear();
    NBTTagList nbttaglist = compound.getTagList("size", 3);
    this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
    this.author = compound.getString("author");
    BasicPalette template$basicpalette = new BasicPalette();
    NBTTagList nbttaglist1 = compound.getTagList("palette", 10);

    for (int i = 0; i < nbttaglist1.tagCount(); ++i)
    {
        template$basicpalette.addMapping(NBTUtil.readBlockState(nbttaglist1.getCompoundTagAt(i)), i);
    }

    NBTTagList nbttaglist3 = compound.getTagList("blocks", 10);

    for (int j = 0; j < nbttaglist3.tagCount(); ++j)
    {
        NBTTagCompound nbttagcompound = nbttaglist3.getCompoundTagAt(j);
        NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
        BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
        IBlockState iblockstate = template$basicpalette.stateFor(nbttagcompound.getInteger("state"));
        NBTTagCompound nbttagcompound1;

        if (nbttagcompound.hasKey("nbt"))
        {
            nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
        }
        else
        {
            nbttagcompound1 = null;
        }

        this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
    }

    NBTTagList nbttaglist4 = compound.getTagList("entities", 10);

    for (int k = 0; k < nbttaglist4.tagCount(); ++k)
    {
        NBTTagCompound nbttagcompound3 = nbttaglist4.getCompoundTagAt(k);
        NBTTagList nbttaglist5 = nbttagcompound3.getTagList("pos", 6);
        Vec3d vec3d = new Vec3d(nbttaglist5.getDoubleAt(0), nbttaglist5.getDoubleAt(1), nbttaglist5.getDoubleAt(2));
        NBTTagList nbttaglist6 = nbttagcompound3.getTagList("blockPos", 3);
        BlockPos blockpos1 = new BlockPos(nbttaglist6.getIntAt(0), nbttaglist6.getIntAt(1), nbttaglist6.getIntAt(2));

        if (nbttagcompound3.hasKey("nbt"))
        {
            NBTTagCompound nbttagcompound2 = nbttagcompound3.getCompoundTag("nbt");
            this.entities.add(new Template.EntityInfo(vec3d, blockpos1, nbttagcompound2));
        }
    }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:55,代碼來源:HarshenTemplate.java

示例4: read

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void read(NBTTagCompound compound)
{
    this.blocks.clear();
    this.entities.clear();
    NBTTagList nbttaglist = compound.getTagList("size", 3);
    this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
    this.author = compound.getString("author");
    Template.BasicPalette template$basicpalette = new Template.BasicPalette();
    NBTTagList nbttaglist1 = compound.getTagList("palette", 10);

    for (int i = 0; i < nbttaglist1.tagCount(); ++i)
    {
        template$basicpalette.addMapping(NBTUtil.readBlockState(nbttaglist1.getCompoundTagAt(i)), i);
    }

    NBTTagList nbttaglist3 = compound.getTagList("blocks", 10);

    for (int j = 0; j < nbttaglist3.tagCount(); ++j)
    {
        NBTTagCompound nbttagcompound = nbttaglist3.getCompoundTagAt(j);
        NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
        BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
        IBlockState iblockstate = template$basicpalette.stateFor(nbttagcompound.getInteger("state"));
        NBTTagCompound nbttagcompound1;

        if (nbttagcompound.hasKey("nbt"))
        {
            nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
        }
        else
        {
            nbttagcompound1 = null;
        }

        this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
    }

    NBTTagList nbttaglist4 = compound.getTagList("entities", 10);

    for (int k = 0; k < nbttaglist4.tagCount(); ++k)
    {
        NBTTagCompound nbttagcompound3 = nbttaglist4.getCompoundTagAt(k);
        NBTTagList nbttaglist5 = nbttagcompound3.getTagList("pos", 6);
        Vec3d vec3d = new Vec3d(nbttaglist5.getDoubleAt(0), nbttaglist5.getDoubleAt(1), nbttaglist5.getDoubleAt(2));
        NBTTagList nbttaglist6 = nbttagcompound3.getTagList("blockPos", 3);
        BlockPos blockpos1 = new BlockPos(nbttaglist6.getIntAt(0), nbttaglist6.getIntAt(1), nbttaglist6.getIntAt(2));

        if (nbttagcompound3.hasKey("nbt"))
        {
            NBTTagCompound nbttagcompound2 = nbttagcompound3.getCompoundTag("nbt");
            this.entities.add(new Template.EntityInfo(vec3d, blockpos1, nbttagcompound2));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:55,代碼來源:Template.java


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