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


Java NBTTagCompound.getString方法代碼示例

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


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

示例1: readScores

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
protected void readScores(NBTTagList nbt)
{
    for (int i = 0; i < nbt.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i);
        ScoreObjective scoreobjective = this.theScoreboard.getObjective(nbttagcompound.getString("Objective"));
        String s = nbttagcompound.getString("Name");

        if (s.length() > 40)
        {
            s = s.substring(0, 40);
        }

        Score score = this.theScoreboard.getValueFromObjective(s, scoreobjective);
        score.setScorePoints(nbttagcompound.getInteger("Score"));

        if (nbttagcompound.hasKey("Locked"))
        {
            score.setLocked(nbttagcompound.getBoolean("Locked"));
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:23,代碼來源:ScoreboardSaveData.java

示例2: validBookTagContents

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static boolean validBookTagContents(NBTTagCompound nbt)
{
    if (!ItemWritableBook.isNBTValid(nbt))
    {
        return false;
    }
    else if (!nbt.hasKey("title", 8))
    {
        return false;
    }
    else
    {
        String s = nbt.getString("title");
        return s != null && s.length() <= 32 ? nbt.hasKey("author", 8) : false;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:ItemEditableBook.java

示例3: readObjectives

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
protected void readObjectives(NBTTagList nbt)
{
    for (int i = 0; i < nbt.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i);
        IScoreObjectiveCriteria iscoreobjectivecriteria = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.INSTANCES.get(nbttagcompound.getString("CriteriaName"));

        if (iscoreobjectivecriteria != null)
        {
            String s = nbttagcompound.getString("Name");

            if (s.length() > 16)
            {
                s = s.substring(0, 16);
            }

            ScoreObjective scoreobjective = this.theScoreboard.addScoreObjective(s, iscoreobjectivecriteria);
            scoreobjective.setDisplayName(nbttagcompound.getString("DisplayName"));
            scoreobjective.setRenderType(IScoreObjectiveCriteria.EnumRenderType.func_178795_a(nbttagcompound.getString("RenderType")));
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:ScoreboardSaveData.java

示例4: getDisplayName

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * returns the display name of the itemstack
 */
public String getDisplayName()
{
    NBTTagCompound nbttagcompound = this.getSubCompound("display");

    if (nbttagcompound != null)
    {
        if (nbttagcompound.hasKey("Name", 8))
        {
            return nbttagcompound.getString("Name");
        }

        if (nbttagcompound.hasKey("LocName", 8))
        {
            return I18n.translateToLocal(nbttagcompound.getString("LocName"));
        }
    }

    return this.getItem().getItemStackDisplayName(this);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:ItemStack.java

示例5: getEntityIdFromItem

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Gets the entity ID associated with a given ItemStack in its NBT data.
 */
@Nullable
public static String getEntityIdFromItem(ItemStack stack)
{
    NBTTagCompound nbttagcompound = stack.getTagCompound();

    if (nbttagcompound == null)
    {
        return null;
    }
    else if (!nbttagcompound.hasKey("EntityTag", 10))
    {
        return null;
    }
    else
    {
        NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("EntityTag");
        return !nbttagcompound1.hasKey("id", 8) ? null : nbttagcompound1.getString("id");
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:ItemMonsterPlacer.java

示例6: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag)
{
    super.readFromNBT(tag);
    activeFaces.clear();
    int faceCount = tag.getInteger("activeFaces");
    for(int i = 0; i < faceCount; i++)
    {
        activeFaces.add(EnumFacing.getFront(tag.getInteger("activeFace_" + i)));
    }
    active = tag.getBoolean("active");
    channel = tag.getString("channel");
    distance = tag.getInteger("distance");
    propagateTime = tag.getInteger("propagateTime");
    fadeoutTime = tag.getInteger("fadeoutTime");
}
 
開發者ID:iChun,項目名稱:GeneralLaymansAestheticSpyingScreen,代碼行數:17,代碼來源:TileEntityGlassBase.java

示例7: readEntityFromNBT

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

    for (EntityPainting.EnumArt entitypainting$enumart : EntityPainting.EnumArt.values())
    {
        if (entitypainting$enumart.title.equals(s))
        {
            this.art = entitypainting$enumart;
        }
    }

    if (this.art == null)
    {
        this.art = EntityPainting.EnumArt.KEBAB;
    }

    super.readEntityFromNBT(compound);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:EntityPainting.java

示例8: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.skullType = compound.getByte("SkullType");
    this.skullRotation = compound.getByte("Rot");

    if (this.skullType == 3)
    {
        if (compound.hasKey("Owner", 10))
        {
            this.playerProfile = NBTUtil.readGameProfileFromNBT(compound.getCompoundTag("Owner"));
        }
        else if (compound.hasKey("ExtraType", 8))
        {
            String s = compound.getString("ExtraType");

            if (!StringUtils.isNullOrEmpty(s))
            {
                this.playerProfile = new GameProfile((UUID)null, s);
                this.updatePlayerProfile();
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:TileEntitySkull.java

示例9: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Set defined game rules from NBT.
 */
public void readFromNBT(NBTTagCompound nbt)
{
    for (String s : nbt.getKeySet())
    {
        String s1 = nbt.getString(s);
        this.setOrCreateGameRule(s, s1);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:12,代碼來源:GameRules.java

示例10: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    NBTTagList nbttaglist = compound.getTagList("Items", 10);
    this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot");

        if (j >= 0 && j < this.furnaceItemStacks.length)
        {
            this.furnaceItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
    }

    this.furnaceBurnTime = compound.getShort("BurnTime");
    this.cookTime = compound.getShort("CookTime");
    this.totalCookTime = compound.getShort("CookTimeTotal");
    this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

    if (compound.hasKey("CustomName", 8))
    {
        this.furnaceCustomName = compound.getString("CustomName");
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:28,代碼來源:TileEntityFurnace.java

示例11: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(@NotNull NBTTagCompound compound) {
    fluid = null;
    isWorkFinished = compound.getBoolean(NBT_WORK);
    if (compound.hasKey(NBT_FLUID)) fluid = compound.getString(NBT_FLUID);
    if (fluid != null && !FluidRegistry.isFluidRegistered(fluid)) fluid = null;
    super.readFromNBT(compound);
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:9,代碼來源:FluidPumpTile.java

示例12: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    vacuum = tag.getBoolean("vacuum");
    grateRange = tag.getInteger("grateRange");
    entityFilter = tag.getString("entityFilter");
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:8,代碼來源:ModuleAirGrate.java

示例13: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
	super.readEntityFromNBT(compound);
	UUID uuid = null;
	if (compound.hasKey("Owner")) {
		String s1 = compound.getString("Owner");
		uuid = getUUID(s1);
	}

	if (uuid != null) {
		try {
			setOwnerId(uuid);
			setTamed(true);
		}
		catch (Throwable var4) {
			setTamed(false);
		}
	}
	if (compound.hasKey("Item") && compound.getCompoundTag("Item") != null) {
		setHeldItemStack(new ItemStack(compound.getCompoundTag("Item")));
	}
	if (compound.hasKey("Chest")) {
		if (chestInventory == null) {
			chestInventory = new TempChest(compound.getInteger("ChestSize"));
		}
		NBTTagList tagList = compound.getTagList("Chest", 10);
		for (int i = 0; i < tagList.tagCount(); i++) {
			NBTTagCompound slotNBT = tagList.getCompoundTagAt(i);
			if (slotNBT != null) {
				chestInventory.setInventorySlotContents(slotNBT.getInteger("Slot"), new ItemStack(slotNBT));
			}
		}
	}
	if (isSitting() != compound.getBoolean("Sitting")) {
		setSitting(compound.getBoolean("Sitting"));
	}
}
 
開發者ID:p455w0rd,項目名稱:EndermanEvolution,代碼行數:38,代碼來源:EntityFrienderman.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: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag, int guiLeft, int guiTop) {
    super.readFromNBT(tag, guiLeft, guiTop);
    widget = new GuiButtonSpecial(-1, tag.getInteger("x") + guiLeft, tag.getInteger("y") + guiTop, tag.getInteger("width"), tag.getInteger("height"), tag.getString("text"));
    settingCoordinate = new BlockPos(tag.getInteger("settingX"), tag.getInteger("settingY"), tag.getInteger("settingZ"));
    widget.setTooltipText(tag.getString("tooltip"));
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:8,代碼來源:ActionWidgetButton.java


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