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


Java NBTBase.getId方法代碼示例

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


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

示例1: parseStructureData

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
private static Set<Long> parseStructureData(MapGenStructureData data) {
    Set<Long> chunks = new HashSet<>();
    NBTTagCompound nbttagcompound = data.getTagCompound();

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

        if (nbtbase.getId() == 10) {
            NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbtbase;

            if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ")) {
                int i = nbttagcompound1.getInteger("ChunkX");
                int j = nbttagcompound1.getInteger("ChunkZ");
                chunks.add(ChunkPos.asLong(i, j));
            }
        }
    }
    return chunks;
}
 
開發者ID:McJty,項目名稱:InControl,代碼行數:20,代碼來源:StructureCache.java

示例2: merge

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public void merge(NBTTagCompound nbt, NBTTagCompound other) {
	Iterator<String> iterator = other.func_150296_c().iterator();

	while (iterator.hasNext()) {
		String s = iterator.next();
		NBTBase nbtbase = other.getTag(s);

		if (nbtbase.getId() == 10) {
			if (nbt.hasKey(s, 10)) {
				NBTTagCompound nbttagcompound1 = nbt.getCompoundTag(s);
				merge(nbttagcompound1, (NBTTagCompound) nbtbase);
			} else
				nbt.setTag(s, nbtbase.copy());
		} else
			nbt.setTag(s, nbtbase.copy());
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:19,代碼來源:ItemArmourStand.java

示例3: func_143027_a

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.setItemData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

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

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:40,代碼來源:MapGenStructure.java

示例4: initializeStructureData

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
protected void initializeStructureData(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.setItemData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

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

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(ChunkPos.asLong(i, j), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:40,代碼來源:MapGenStructure.java

示例5: initializeStructureData

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
protected void initializeStructureData(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.getPerWorldStorage().getOrLoadData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.getPerWorldStorage().setData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

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

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(ChunkPos.asLong(i, j), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:40,代碼來源:MapGenStructure.java

示例6: readEntityFromNBT

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.setAbsorptionAmount(tagCompund.getFloat("AbsorptionAmount"));

    if (tagCompund.hasKey("Attributes", 9) && this.worldObj != null && !this.worldObj.isRemote)
    {
        SharedMonsterAttributes.func_151475_a(this.getAttributeMap(), tagCompund.getTagList("Attributes", 10));
    }

    if (tagCompund.hasKey("ActiveEffects", 9))
    {
        NBTTagList nbttaglist = tagCompund.getTagList("ActiveEffects", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);

            if (potioneffect != null)
            {
                this.activePotionsMap.put(Integer.valueOf(potioneffect.getPotionID()), potioneffect);
            }
        }
    }

    if (tagCompund.hasKey("HealF", 99))
    {
        this.setHealth(tagCompund.getFloat("HealF"));
    }
    else
    {
        NBTBase nbtbase = tagCompund.getTag("Health");

        if (nbtbase == null)
        {
            this.setHealth(this.getMaxHealth());
        }
        else if (nbtbase.getId() == 5)
        {
            this.setHealth(((NBTTagFloat)nbtbase).getFloat());
        }
        else if (nbtbase.getId() == 2)
        {
            this.setHealth((float)((NBTTagShort)nbtbase).getShort());
        }
    }

    this.hurtTime = tagCompund.getShort("HurtTime");
    this.deathTime = tagCompund.getShort("DeathTime");
    this.revengeTimer = tagCompund.getInteger("HurtByTimestamp");
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:55,代碼來源:EntityLivingBase.java

示例7: func_143027_a

import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        if (Reflector.ForgeWorld_getPerWorldStorage.exists())
        {
            MapStorage mapstorage = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
            this.structureData = (MapGenStructureData)mapstorage.loadData(MapGenStructureData.class, this.getStructureName());
        }
        else
        {
            this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());
        }

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());

            if (Reflector.ForgeWorld_getPerWorldStorage.exists())
            {
                MapStorage mapstorage1 = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
                mapstorage1.setData(this.getStructureName(), this.structureData);
            }
            else
            {
                worldIn.setItemData(this.getStructureName(), this.structureData);
            }
        }
        else
        {
            NBTTagCompound nbttagcompound1 = this.structureData.getTagCompound();

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

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound = (NBTTagCompound)nbtbase;

                    if (nbttagcompound.hasKey("ChunkX") && nbttagcompound.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound.getInteger("ChunkX");
                        int j = nbttagcompound.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                            this.structureLongMap.add(ChunkCoordIntPair.chunkXZ2Int(i, j), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:58,代碼來源:MapGenStructure.java


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