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


Java NBTTagCompound.hasNoTags方法代碼示例

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


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

示例1: readEntityFromNBT

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

    if (nbttagcompound != null && !nbttagcompound.hasNoTags())
    {
        this.setDisplayedItemWithUpdate(ItemStack.loadItemStackFromNBT(nbttagcompound), false);
        this.func_174865_a(tagCompund.getByte("ItemRotation"), false);

        if (tagCompund.hasKey("ItemDropChance", 99))
        {
            this.itemDropChance = tagCompund.getFloat("ItemDropChance");
        }

        if (tagCompund.hasKey("Direction"))
        {
            this.func_174865_a(this.getRotation() * 2, false);
        }
    }

    super.readEntityFromNBT(tagCompund);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:26,代碼來源:EntityItemFrame.java

示例2: clearCustomName

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Clear any custom name set for this ItemStack
 */
public void clearCustomName()
{
    if (this.stackTagCompound != null)
    {
        if (this.stackTagCompound.hasKey("display", 10))
        {
            NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
            nbttagcompound.removeTag("Name");

            if (nbttagcompound.hasNoTags())
            {
                this.stackTagCompound.removeTag("display");

                if (this.stackTagCompound.hasNoTags())
                {
                    this.setTagCompound((NBTTagCompound)null);
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:ItemStack.java

示例3: writeStatsToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void writeStatsToNBT(NBTTagCompound tagcompound)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();

    for (CommandResultStats.Type commandresultstats$type : CommandResultStats.Type.values())
    {
        String s = this.field_179675_c[commandresultstats$type.getTypeID()];
        String s1 = this.field_179673_d[commandresultstats$type.getTypeID()];

        if (s != null && s1 != null)
        {
            nbttagcompound.setString(commandresultstats$type.getTypeName() + "Name", s);
            nbttagcompound.setString(commandresultstats$type.getTypeName() + "Objective", s1);
        }
    }

    if (!nbttagcompound.hasNoTags())
    {
        tagcompound.setTag("CommandStats", nbttagcompound);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:CommandResultStats.java

示例4: writeStatsToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void writeStatsToNBT(NBTTagCompound tagcompound)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();

    for (CommandResultStats.Type commandresultstats$type : CommandResultStats.Type.values())
    {
        String s = this.entitiesID[commandresultstats$type.getTypeID()];
        String s1 = this.objectives[commandresultstats$type.getTypeID()];

        if (s != null && s1 != null)
        {
            nbttagcompound.setString(commandresultstats$type.getTypeName() + "Name", s);
            nbttagcompound.setString(commandresultstats$type.getTypeName() + "Objective", s1);
        }
    }

    if (!nbttagcompound.hasNoTags())
    {
        tagcompound.setTag("CommandStats", nbttagcompound);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:CommandResultStats.java

示例5: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Write the stack fields to a NBT object. Return the new NBT object.
 */
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
    ResourceLocation resourcelocation = (ResourceLocation)Item.REGISTRY.getNameForObject(this.item);
    nbt.setString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString());
    nbt.setByte("Count", (byte)this.stackSize);
    nbt.setShort("Damage", (short)this.itemDamage);

    if (this.stackTagCompound != null)
    {
        nbt.setTag("tag", this.stackTagCompound);
    }

    if (this.capabilities != null)
    {
        NBTTagCompound cnbt = this.capabilities.serializeNBT();
        if (!cnbt.hasNoTags()) nbt.setTag("ForgeCaps", cnbt);
    }

    return nbt;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:ItemStack.java

示例6: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    NBTTagCompound nbttagcompound = compound.getCompoundTag("Item");

    if (nbttagcompound != null && !nbttagcompound.hasNoTags())
    {
        this.setDisplayedItemWithUpdate(new ItemStack(nbttagcompound), false);
        this.setRotation(compound.getByte("ItemRotation"), false);

        if (compound.hasKey("ItemDropChance", 99))
        {
            this.itemDropChance = compound.getFloat("ItemDropChance");
        }
    }

    super.readEntityFromNBT(compound);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:EntityItemFrame.java

示例7: clearCustomName

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Clear any custom name set for this ItemStack
 */
public void clearCustomName()
{
    NBTTagCompound nbttagcompound = this.getSubCompound("display");

    if (nbttagcompound != null)
    {
        nbttagcompound.removeTag("Name");

        if (nbttagcompound.hasNoTags())
        {
            this.func_190919_e("display");
        }
    }

    if (this.stackTagCompound != null && this.stackTagCompound.hasNoTags())
    {
        this.stackTagCompound = null;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:ItemStack.java

示例8: addPotionToItemStack

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static ItemStack addPotionToItemStack(ItemStack itemIn, PotionType potionIn)
{
    ResourceLocation resourcelocation = (ResourceLocation)PotionType.REGISTRY.getNameForObject(potionIn);

    if (potionIn == PotionTypes.EMPTY)
    {
        if (itemIn.hasTagCompound())
        {
            NBTTagCompound nbttagcompound = itemIn.getTagCompound();
            nbttagcompound.removeTag("Potion");

            if (nbttagcompound.hasNoTags())
            {
                itemIn.setTagCompound((NBTTagCompound)null);
            }
        }
    }
    else
    {
        NBTTagCompound nbttagcompound1 = itemIn.hasTagCompound() ? itemIn.getTagCompound() : new NBTTagCompound();
        nbttagcompound1.setString("Potion", resourcelocation.toString());
        itemIn.setTagCompound(nbttagcompound1);
    }

    return itemIn;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:PotionUtils.java

示例9: saveStackNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static void saveStackNBT(ItemStack stack, NBTTagCompound nbt)
{
	if (!stack.hasTagCompound() && !nbt.hasNoTags())
	{
		stack.setTagCompound(nbt);
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:8,代碼來源:NBTHelper.java

示例10: getItem

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
{
    ItemStack itemstack = super.getItem(worldIn, pos, state);
    TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox)worldIn.getTileEntity(pos);
    NBTTagCompound nbttagcompound = tileentityshulkerbox.func_190580_f(new NBTTagCompound());

    if (!nbttagcompound.hasNoTags())
    {
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
    }

    return itemstack;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:BlockShulkerBox.java

示例11: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("minecraft:shulker_box".equals(compound.getString("id")) && compound.hasKey("tag", 10))
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");

        if (nbttagcompound.hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");

            if (nbttagcompound1.getTagList("Items", 10).hasNoTags())
            {
                nbttagcompound1.removeTag("Items");
            }

            int i = nbttagcompound1.getInteger("Color");
            nbttagcompound1.removeTag("Color");

            if (nbttagcompound1.hasNoTags())
            {
                nbttagcompound.removeTag("BlockEntityTag");
            }

            if (nbttagcompound.hasNoTags())
            {
                compound.removeTag("tag");
            }

            compound.setString("id", field_191278_a[i % 16]);
        }
    }

    return compound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:35,代碼來源:ShulkerBoxItemColor.java

示例12: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("minecraft:banner".equals(compound.getString("id")) && compound.hasKey("tag", 10))
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");

        if (nbttagcompound.hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");

            if (nbttagcompound1.hasKey("Base", 99))
            {
                compound.setShort("Damage", (short)(nbttagcompound1.getShort("Base") & 15));

                if (nbttagcompound.hasKey("display", 10))
                {
                    NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("display");

                    if (nbttagcompound2.hasKey("Lore", 9))
                    {
                        NBTTagList nbttaglist = nbttagcompound2.getTagList("Lore", 8);

                        if (nbttaglist.tagCount() == 1 && "(+NBT)".equals(nbttaglist.getStringTagAt(0)))
                        {
                            return compound;
                        }
                    }
                }

                nbttagcompound1.removeTag("Base");

                if (nbttagcompound1.hasNoTags())
                {
                    nbttagcompound.removeTag("BlockEntityTag");
                }

                if (nbttagcompound.hasNoTags())
                {
                    compound.removeTag("tag");
                }
            }
        }
    }

    return compound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:47,代碼來源:BannerItemColor.java


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