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


Java NBTTagCompound.removeTag方法代碼示例

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


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

示例1: removeColor

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Remove the color from the specified armor ItemStack.
 */
public void removeColor(ItemStack stack)
{
    if (this.material == ItemArmor.ArmorMaterial.LEATHER)
    {
        NBTTagCompound nbttagcompound = stack.getTagCompound();

        if (nbttagcompound != null)
        {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");

            if (nbttagcompound1.hasKey("color"))
            {
                nbttagcompound1.removeTag("color");
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:ItemArmor.java

示例2: dropBlockAsItemWithChance

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Spawns this Block's drops into the World as EntityItems.
 */
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        tileentity.writeToNBT(nbttagcompound);
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:25,代碼來源:BlockBanner.java

示例3: setAbstractCropGrowth

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static void setAbstractCropGrowth(EntityPlayer player, boolean add) {
	
	NBTTagCompound tag = player.getEntityData();
	if (!tag.hasKey(TAG_ABSTRACT) && add) {
		tag.setInteger(TAG_ABSTRACT, 1);
		return;
	}
	if (add) {
		tag.setInteger(TAG_ABSTRACT, tag.getInteger(TAG_ABSTRACT) + 1);
	}
	else if (!add) {
		int value = tag.getInteger(TAG_ABSTRACT);
		if (player.worldObj.rand.nextInt(5) == 0)
			tag.setInteger(TAG_ABSTRACT, value - 1);
	}
	if (tag.getInteger(TAG_ABSTRACT) <= 0)
		tag.removeTag(TAG_ABSTRACT);
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:19,代碼來源:SeedBehavior.java

示例4: canAdvance

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	TileEntity tile = world.getTileEntity(pos);
	if (tile != null && tile instanceof TileFeroxia) {
		TileFeroxia te = (TileFeroxia)tile;
		EntityPlayer player = UCUtils.getPlayerFromUUID(te.getOwner().toString());
		if (!world.isRemote && player != null && world.getPlayerEntityByUUID(te.getOwner()) != null) {
			NBTTagCompound tag = player.getEntityData();
			if (!tag.hasKey("hasSacrificed"))
			{
				player.addChatMessage(new TextComponentString(TextFormatting.RED + "The savage plant whispers: \"The time is right to perform a self sacrifice.\""));
				tag.setBoolean("hasSacrificed", false);
				return false;
			}
			if (tag.hasKey("hasSacrificed") && tag.getBoolean("hasSacrificed"))
			{
				tag.removeTag("hasSacrificed");
				world.setBlockState(pos, ((Feroxia)state.getBlock()).withAge(7), 2);
				GrowthSteps.generateSteps(player);
				return false;
			}
		}
	}
	return false;
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:27,代碼來源:GrowthSteps.java

示例5: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("Zombie".equals(compound.getString("id")))
    {
        int i = compound.getInteger("ZombieType");

        switch (i)
        {
            case 0:
            default:
                break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                compound.setString("id", "ZombieVillager");
                compound.setInteger("Profession", i - 1);
                break;

            case 6:
                compound.setString("id", "Husk");
        }

        compound.removeTag("ZombieType");
    }

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

示例6: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if (!"MobSpawner".equals(compound.getString("id")))
    {
        return compound;
    }
    else
    {
        if (compound.hasKey("EntityId", 8))
        {
            String s = compound.getString("EntityId");
            NBTTagCompound nbttagcompound = compound.getCompoundTag("SpawnData");
            nbttagcompound.setString("id", s.isEmpty() ? "Pig" : s);
            compound.setTag("SpawnData", nbttagcompound);
            compound.removeTag("EntityId");
        }

        if (compound.hasKey("SpawnPotentials", 9))
        {
            NBTTagList nbttaglist = compound.getTagList("SpawnPotentials", 10);

            for (int i = 0; i < nbttaglist.tagCount(); ++i)
            {
                NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);

                if (nbttagcompound1.hasKey("Type", 8))
                {
                    NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompoundTag("Properties");
                    nbttagcompound2.setString("id", nbttagcompound1.getString("Type"));
                    nbttagcompound1.setTag("Entity", nbttagcompound2);
                    nbttagcompound1.removeTag("Type");
                    nbttagcompound1.removeTag("Properties");
                }
            }
        }

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

示例7: getDescriptionPacket

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the
 * server to the client easily. For example this is used by signs to synchronise the text to be displayed.
 */
public Packet getDescriptionPacket()
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    this.writeToNBT(nbttagcompound);
    nbttagcompound.removeTag("Item");
    nbttagcompound.setInteger("Item", Item.getIdFromItem(this.flowerPotItem));
    return new S35PacketUpdateTileEntity(this.pos, 5, nbttagcompound);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:TileEntityFlowerPot.java

示例8: copyDataFromOld

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Prepares this entity in new dimension by copying NBT data from entity in old dimension
 */
private void copyDataFromOld(Entity entityIn)
{
    NBTTagCompound nbttagcompound = entityIn.writeToNBT(new NBTTagCompound());
    nbttagcompound.removeTag("Dimension");
    this.readFromNBT(nbttagcompound);
    this.timeUntilPortal = entityIn.timeUntilPortal;
    this.lastPortalPos = entityIn.lastPortalPos;
    this.lastPortalVec = entityIn.lastPortalVec;
    this.teleportDirection = entityIn.teleportDirection;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:14,代碼來源:Entity.java

示例9: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("EntityHorse".equals(compound.getString("id")) && !compound.hasKey("SaddleItem", 10) && compound.getBoolean("Saddle"))
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setString("id", "minecraft:saddle");
        nbttagcompound.setByte("Count", (byte)1);
        nbttagcompound.setShort("Damage", (short)0);
        compound.setTag("SaddleItem", nbttagcompound);
        compound.removeTag("Saddle");
    }

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

示例10: process

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
    if (!compound.hasKey("tag", 10))
    {
        return compound;
    }
    else
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");

        if (nbttagcompound.hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
            String s = compound.getString("id");
            String s1 = getBlockEntityID(s);
            boolean flag;

            if (s1 == null)
            {
                LOGGER.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] {s});
                flag = false;
            }
            else
            {
                flag = !nbttagcompound1.hasKey("id");
                nbttagcompound1.setString("id", s1);
            }

            fixer.process(FixTypes.BLOCK_ENTITY, nbttagcompound1, versionIn);

            if (flag)
            {
                nbttagcompound1.removeTag("id");
            }
        }

        return compound;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:40,代碼來源:BlockEntityTag.java

示例11: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    String s = compound.getString("id");
    boolean flag = "Painting".equals(s);
    boolean flag1 = "ItemFrame".equals(s);

    if ((flag || flag1) && !compound.hasKey("Facing", 99))
    {
        EnumFacing enumfacing;

        if (compound.hasKey("Direction", 99))
        {
            enumfacing = EnumFacing.getHorizontal(compound.getByte("Direction"));
            compound.setInteger("TileX", compound.getInteger("TileX") + enumfacing.getFrontOffsetX());
            compound.setInteger("TileY", compound.getInteger("TileY") + enumfacing.getFrontOffsetY());
            compound.setInteger("TileZ", compound.getInteger("TileZ") + enumfacing.getFrontOffsetZ());
            compound.removeTag("Direction");

            if (flag1 && compound.hasKey("ItemRotation", 99))
            {
                compound.setByte("ItemRotation", (byte)(compound.getByte("ItemRotation") * 2));
            }
        }
        else
        {
            enumfacing = EnumFacing.getHorizontal(compound.getByte("Dir"));
            compound.removeTag("Dir");
        }

        compound.setByte("Facing", (byte)enumfacing.getHorizontalIndex());
    }

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

示例12: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("Zombie".equals(compound.getString("id")) && compound.getBoolean("IsVillager"))
    {
        if (!compound.hasKey("ZombieType", 99))
        {
            ZombieType zombietype = null;

            if (compound.hasKey("VillagerProfession", 99))
            {
                try
                {
                    zombietype = ZombieType.getByOrdinal(compound.getInteger("VillagerProfession") + 1);
                }
                catch (RuntimeException var4)
                {
                    ;
                }
            }

            if (zombietype == null)
            {
                zombietype = ZombieType.getByOrdinal(RANDOM.nextInt(5) + 1);
            }

            compound.setInteger("ZombieType", zombietype.getId());
        }

        compound.removeTag("IsVillager");
    }

    return compound;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:ZombieProfToType.java

示例13: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("ArmorStand".equals(compound.getString("id")) && compound.getBoolean("Silent") && !compound.getBoolean("Marker"))
    {
        compound.removeTag("Silent");
    }

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

示例14: process

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
    if (!compound.hasKey("tag", 10))
    {
        return compound;
    }
    else
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");

        if (nbttagcompound.hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
            String s = compound.getString("id");
            String s1 = getBlockEntityID(versionIn, s);
            boolean flag;

            if (s1 == null)
            {
                LOGGER.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] {s});
                flag = false;
            }
            else
            {
                flag = !nbttagcompound1.hasKey("id");
                nbttagcompound1.setString("id", s1);
            }

            fixer.process(FixTypes.BLOCK_ENTITY, nbttagcompound1, versionIn);

            if (flag)
            {
                nbttagcompound1.removeTag("id");
            }
        }

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

示例15: getUpdateTag

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound getUpdateTag()
{
    NBTTagCompound nbttagcompound = this.writeToNBT(new NBTTagCompound());
    nbttagcompound.removeTag("SpawnPotentials");
    return nbttagcompound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:7,代碼來源:TileEntityMobSpawner.java


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