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


Java NBTTagList.hasNoTags方法代碼示例

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


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

示例1: loadItems

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private void loadItems(NBTTagCompound cmp) {
	NBTTagList nbttaglist = cmp.getTagList(TAG_INGREDIENTS, 10);
	if (nbttaglist.hasNoTags()) ingredients.clear();
	for (NBTBase nbt : nbttaglist) {
		if (nbt instanceof NBTTagCompound) {
			ingredients.add(new ItemStack((NBTTagCompound) nbt));
		}
	}

	if (cmp.hasKey(TAG_CONTAINER)) {
		NBTTagCompound tag = cmp.getCompoundTag(TAG_CONTAINER);
		container = new ItemStack(tag);
	} else {
		container = ItemStack.EMPTY;
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:17,代碼來源:TileCauldron.java

示例2: createToolString

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private String createToolString(ItemStack tool) {
	String toolString = "";
	if (tool == null || tool.getItem() == null) {
		return toolString;
	}
	toolString += tool.getItem().getUnlocalizedName();
	toolString += ";;";
	if (tool.getEnchantmentTagList() != null) {
		toolString += tool.getEnchantmentTagList().toString();
	}
	if (tool.hasTagCompound() && tool.getTagCompound().hasKey("display")) {
		NBTTagCompound displayTag = tool.getTagCompound().getCompoundTag("display");
		if (displayTag.getTagId("Lore") == 9) {
			NBTTagList nbttaglist3 = displayTag.getTagList("Lore", 8);
			if (!nbttaglist3.hasNoTags()) {
				for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1) {
					toolString += ";;";
					toolString += nbttaglist3.getStringTagAt(l1);
				}
			}
		}
	}
	return toolString;
}
 
開發者ID:Maxopoly,項目名稱:OreLogger,代碼行數:25,代碼來源:HiddenOreSpawnManager.java

示例3: removeBannerData

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * Removes all the banner related data from a provided instance of ItemStack.
 */
public static void removeBannerData(ItemStack stack)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns", 9))
    {
        NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);

        if (nbttaglist.tagCount() > 0)
        {
            nbttaglist.removeTag(nbttaglist.tagCount() - 1);

            if (nbttaglist.hasNoTags())
            {
                stack.getTagCompound().removeTag("BlockEntityTag");

                if (stack.getTagCompound().hasNoTags())
                {
                    stack.setTagCompound((NBTTagCompound)null);
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:28,代碼來源:TileEntityBanner.java

示例4: writeToNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {

	NBTTagList nbttaglist = new NBTTagList();

	for (int i = 0; i < itemList.size(); ++i) {
		TubeItem itemstack = (TubeItem) itemList.get(i);

		NBTTagCompound nbttagcompound = new NBTTagCompound();
		nbttagcompound.setByte("Slot", (byte) i);
		itemstack.writeNBT(nbttagcompound);
		nbttaglist.appendTag(nbttagcompound);

	}

	if (!nbttaglist.hasNoTags()) {
		nbt.setTag("Items", nbttaglist);
	}

	nbt.setInteger("color", this.tubeColor);

	return super.writeToNBT(nbt);
}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:24,代碼來源:TileTube.java

示例5: func_191281_a

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public static NBTTagCompound func_191281_a(NBTTagCompound p_191281_0_, NonNullList<ItemStack> p_191281_1_, boolean p_191281_2_)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < p_191281_1_.size(); ++i)
    {
        ItemStack itemstack = (ItemStack)p_191281_1_.get(i);

        if (!itemstack.func_190926_b())
        {
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setByte("Slot", (byte)i);
            itemstack.writeToNBT(nbttagcompound);
            nbttaglist.appendTag(nbttagcompound);
        }
    }

    if (!nbttaglist.hasNoTags() || p_191281_2_)
    {
        p_191281_0_.setTag("Items", nbttaglist);
    }

    return p_191281_0_;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:ItemStackHelper.java

示例6: removeBannerData

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * Removes all the banner related data from a provided instance of ItemStack.
 */
public static void removeBannerData(ItemStack stack)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag");

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns", 9))
    {
        NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);

        if (!nbttaglist.hasNoTags())
        {
            nbttaglist.removeTag(nbttaglist.tagCount() - 1);

            if (nbttaglist.hasNoTags())
            {
                stack.getTagCompound().removeTag("BlockEntityTag");

                if (stack.getTagCompound().hasNoTags())
                {
                    stack.setTagCompound((NBTTagCompound)null);
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:28,代碼來源:TileEntityBanner.java

示例7: unpackNodes

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private void unpackNodes(NBTTagList list, ArrayList<ScarfNode> scarf, ArrayList<ScarfNode> existing) {
	if (list.hasNoTags()) return;
	for(NBTBase nbt : list) {
		if (!(nbt instanceof NBTTagCompound)) break;
		ScarfNode node  = unpackSquare((NBTTagCompound)nbt);
		if (existing!=null && !existing.isEmpty()) {
			ScarfNode prior = existing.remove(0);
			node.inheritMotion(prior);
		}
		
		scarf.add(node);
	}
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:14,代碼來源:Scarf.java

示例8: func_190910_a

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public static ItemStack func_190910_a(EnumDyeColor p_190910_0_, @Nullable NBTTagList p_190910_1_)
{
    ItemStack itemstack = new ItemStack(Items.BANNER, 1, p_190910_0_.getDyeDamage());

    if (p_190910_1_ != null && !p_190910_1_.hasNoTags())
    {
        itemstack.func_190925_c("BlockEntityTag").setTag("Patterns", p_190910_1_.copy());
    }

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

示例9: addInformation

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("Fireworks");

    if (nbttagcompound != null)
    {
        if (nbttagcompound.hasKey("Flight", 99))
        {
            tooltip.add(I18n.translateToLocal("item.fireworks.flight") + " " + nbttagcompound.getByte("Flight"));
        }

        NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10);

        if (!nbttaglist.hasNoTags())
        {
            for (int i = 0; i < nbttaglist.tagCount(); ++i)
            {
                NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
                List<String> list = Lists.<String>newArrayList();
                ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);

                if (!list.isEmpty())
                {
                    for (int j = 1; j < ((List)list).size(); ++j)
                    {
                        list.set(j, "  " + (String)list.get(j));
                    }

                    tooltip.addAll(list);
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:38,代碼來源:ItemFirework.java

示例10: setEnchantments

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * Set the enchantments for the specified stack.
 */
public static void setEnchantments(Map<Enchantment, Integer> enchMap, ItemStack stack)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (Entry<Enchantment, Integer> entry : enchMap.entrySet())
    {
        Enchantment enchantment = (Enchantment)entry.getKey();

        if (enchantment != null)
        {
            int i = ((Integer)entry.getValue()).intValue();
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setShort("id", (short)Enchantment.getEnchantmentID(enchantment));
            nbttagcompound.setShort("lvl", (short)i);
            nbttaglist.appendTag(nbttagcompound);

            if (stack.getItem() == Items.ENCHANTED_BOOK)
            {
                Items.ENCHANTED_BOOK.addEnchantment(stack, new EnchantmentData(enchantment, i));
            }
        }
    }

    if (nbttaglist.hasNoTags())
    {
        if (stack.hasTagCompound())
        {
            stack.getTagCompound().removeTag("ench");
        }
    }
    else if (stack.getItem() != Items.ENCHANTED_BOOK)
    {
        stack.setTagInfo("ench", nbttaglist);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:39,代碼來源:EnchantmentHelper.java

示例11: addInformation

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * allows items to add custom lines of information to the mouseover description
 */
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    if (stack.hasTagCompound())
    {
        NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Fireworks");

        if (nbttagcompound != null)
        {
            if (nbttagcompound.hasKey("Flight", 99))
            {
                tooltip.add(I18n.translateToLocal("item.fireworks.flight") + " " + nbttagcompound.getByte("Flight"));
            }

            NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10);

            if (nbttaglist != null && !nbttaglist.hasNoTags())
            {
                for (int i = 0; i < nbttaglist.tagCount(); ++i)
                {
                    NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
                    List<String> list = Lists.<String>newArrayList();
                    ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);

                    if (!list.isEmpty())
                    {
                        for (int j = 1; j < ((List)list).size(); ++j)
                        {
                            list.set(j, "  " + (String)list.get(j));
                        }

                        tooltip.addAll(list);
                    }
                }
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:42,代碼來源:ItemFirework.java

示例12: 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

示例13: func_191510_k

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private void func_191510_k()
{
    float f = 0.0F;
    ItemStack itemstack = (ItemStack)this.dataManager.get(FIREWORK_ITEM);
    NBTTagCompound nbttagcompound = itemstack.func_190926_b() ? null : itemstack.getSubCompound("Fireworks");
    NBTTagList nbttaglist = nbttagcompound != null ? nbttagcompound.getTagList("Explosions", 10) : null;

    if (nbttaglist != null && !nbttaglist.hasNoTags())
    {
        f = (float)(5 + nbttaglist.tagCount() * 2);
    }

    if (f > 0.0F)
    {
        if (this.field_191513_e != null)
        {
            this.field_191513_e.attackEntityFrom(DamageSource.field_191552_t, (float)(5 + nbttaglist.tagCount() * 2));
        }

        double d0 = 5.0D;
        Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ);

        for (EntityLivingBase entitylivingbase : this.world.getEntitiesWithinAABB(EntityLivingBase.class, this.getEntityBoundingBox().expandXyz(5.0D)))
        {
            if (entitylivingbase != this.field_191513_e && this.getDistanceSqToEntity(entitylivingbase) <= 25.0D)
            {
                boolean flag = false;

                for (int i = 0; i < 2; ++i)
                {
                    RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, new Vec3d(entitylivingbase.posX, entitylivingbase.posY + (double)entitylivingbase.height * 0.5D * (double)i, entitylivingbase.posZ), false, true, false);

                    if (raytraceresult == null || raytraceresult.typeOfHit == RayTraceResult.Type.MISS)
                    {
                        flag = true;
                        break;
                    }
                }

                if (flag)
                {
                    float f1 = f * (float)Math.sqrt((5.0D - (double)this.getDistanceToEntity(entitylivingbase)) / 5.0D);
                    entitylivingbase.attackEntityFrom(DamageSource.field_191552_t, f1);
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:49,代碼來源:EntityFireworkRocket.java

示例14: fixTagCompound

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    NBTTagList nbttaglist = compound.getTagList("Equipment", 10);

    if (!nbttaglist.hasNoTags() && !compound.hasKey("HandItems", 10))
    {
        NBTTagList nbttaglist1 = new NBTTagList();
        nbttaglist1.appendTag(nbttaglist.get(0));
        nbttaglist1.appendTag(new NBTTagCompound());
        compound.setTag("HandItems", nbttaglist1);
    }

    if (nbttaglist.tagCount() > 1 && !compound.hasKey("ArmorItem", 10))
    {
        NBTTagList nbttaglist3 = new NBTTagList();
        nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(1));
        nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(2));
        nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(3));
        nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(4));
        compound.setTag("ArmorItems", nbttaglist3);
    }

    compound.removeTag("Equipment");

    if (compound.hasKey("DropChances", 9))
    {
        NBTTagList nbttaglist4 = compound.getTagList("DropChances", 5);

        if (!compound.hasKey("HandDropChances", 10))
        {
            NBTTagList nbttaglist2 = new NBTTagList();
            nbttaglist2.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(0)));
            nbttaglist2.appendTag(new NBTTagFloat(0.0F));
            compound.setTag("HandDropChances", nbttaglist2);
        }

        if (!compound.hasKey("ArmorDropChances", 10))
        {
            NBTTagList nbttaglist5 = new NBTTagList();
            nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(1)));
            nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(2)));
            nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(3)));
            nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(4)));
            compound.setTag("ArmorDropChances", nbttaglist5);
        }

        compound.removeTag("DropChances");
    }

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


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