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


Java NBTTagCompound.setString方法代碼示例

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


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

示例1: getSchematic

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Write to schematic tags
 * @return Control tag
 */
private NBTTagCompound getSchematic() {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setString("Materials", "Alpha");
    tag.setShort("Width", (short) getWidth());
    tag.setShort("Height", (short) getHeight());
    tag.setShort("Length", (short) getLength());
    tag.setByteArray("AddBlocks", new byte[0]);
    byte[] blocksID = new byte[getBlocks().length];
    for (int i = 0; i < getBlocks().length; ++i) {
        blocksID[i] = (byte) getBlock(i);
    }
    tag.setByteArray("Blocks", blocksID);
    tag.setByteArray("AddBlocks", getAddBlocks(getBlocks()));
    tag.setByteArray("Data", getMetas());
    NBTTagList tileEntities = new NBTTagList();
    for (NBTTagCompound tile : getTiles()) {
        if (tile != null) {
            tileEntities.appendTag(tile);
        }
    }
    tag.setTag("TileEntities", tileEntities);
    return tag;
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:28,代碼來源:Blueprint.java

示例2: writeMountToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Like writeToNBTOptional but does not check if the entity is ridden. Used for saving ridden entities with their
 * riders.
 */
public boolean writeMountToNBT(NBTTagCompound tagCompund)
{
    String s = this.getEntityString();

    if (!this.isDead && s != null)
    {
        tagCompund.setString("id", s);
        this.writeToNBT(tagCompund);
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:Entity.java

示例3: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
	super.writeToNBT(compound);
	compound.setTag("items", inventory.saveToNbt());

	if (inventory.hasCustomName()) {
		compound.setString("CustomName", this.customName);
	}

	compound.setInteger("WorkTime", (short) this.workTime);
	compound.setInteger("totalWorkTime", (short) this.totalWorkTime);
	compound.setInteger("BurnTime", (short) this.burnTime);
	compound.setInteger("itemBurnTime", (short) this.itemBurnTime);
	compound.setBoolean("isBurning", this.isBurning);
	return compound;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:17,代碼來源:TileOven.java

示例4: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setShort("Health", (short)((byte)this.health));
    tagCompound.setShort("Age", (short)this.age);
    tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup);

    if (this.getThrower() != null)
    {
        tagCompound.setString("Thrower", this.thrower);
    }

    if (this.getOwner() != null)
    {
        tagCompound.setString("Owner", this.owner);
    }

    if (this.getEntityItem() != null)
    {
        tagCompound.setTag("Item", this.getEntityItem().writeToNBT(new NBTTagCompound()));
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:25,代碼來源:EntityItem.java

示例5: 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:sudofox,項目名稱:Backmemed,代碼行數:22,代碼來源:CommandResultStats.java

示例6: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.inventory.length; ++i)
    {
        if (this.inventory[i] != null)
        {
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setByte("Slot", (byte)i);
            this.inventory[i].writeToNBT(nbttagcompound);
            nbttaglist.appendTag(nbttagcompound);
        }
    }

    compound.setTag("Items", nbttaglist);
    compound.setInteger("TransferCooldown", this.transferCooldown);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.customName);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:TileEntityHopper.java

示例7: func_96497_d

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
protected void func_96497_d(NBTTagCompound p_96497_1_)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    boolean flag = false;

    for (int i = 0; i < 19; ++i)
    {
        ScoreObjective scoreobjective = this.theScoreboard.getObjectiveInDisplaySlot(i);

        if (scoreobjective != null)
        {
            nbttagcompound.setString("slot_" + i, scoreobjective.getName());
            flag = true;
        }
    }

    if (flag)
    {
        p_96497_1_.setTag("DisplaySlots", nbttagcompound);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:ScoreboardSaveData.java

示例8: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setInteger("BurnTime", this.furnaceBurnTime);
    compound.setInteger("CookTime", this.cookTime);
    compound.setInteger("CookTimeTotal", this.totalCookTime);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.furnaceItemStacks.length; ++i)
    {
        if (this.furnaceItemStacks[i] != null)
        {
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setByte("Slot", (byte)i);
            this.furnaceItemStacks[i].writeToNBT(nbttagcompound);
            nbttaglist.appendTag(nbttagcompound);
        }
    }

    compound.setTag("Items", nbttaglist);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.furnaceCustomName);
    }

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

示例9: getSaveData

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static NBTTagCompound getSaveData(ModelObj model)
{
	NBTTagCompound parentNBT = new NBTTagCompound();
	NBTTagList parentNBTList = new NBTTagList();

	for (PartObj part : model.getPartObjs())
	{
		Set<PartObj> children = part.getChildren();
		List<PartObj> mergeParts = part.getMergedParts();
		if (!children.isEmpty() || !mergeParts.isEmpty())
		{
			NBTTagCompound parentCompound = new NBTTagCompound();
			parentCompound.setString("Parent", part.getName());

			int i = 0;
			for (PartObj child : children)
			{
				String name = child.getName();
				if (child.hasBend())
				{
					name += "*";
				}
				parentCompound.setString("Child" + i, name);
				i++;
			}
			
			for(int j = 0; j < mergeParts.size(); j++)
			{
				PartObj mergedPart = mergeParts.get(j);
				parentCompound.setString("Merged" + j, mergedPart.getName());
			}

			parentNBTList.appendTag(parentCompound);
		}

	}

	parentNBT.setTag("Parenting", parentNBTList);
	return parentNBT;
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:41,代碼來源:AnimationParenting.java

示例10: writeToNBT

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

    if (!this.checkLootAndWrite(compound))
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < this.inventory.length; ++i)
        {
            if (this.inventory[i] != null)
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();
                nbttagcompound.setByte("Slot", (byte)i);
                this.inventory[i].writeToNBT(nbttagcompound);
                nbttaglist.appendTag(nbttagcompound);
            }
        }

        compound.setTag("Items", nbttaglist);
    }

    compound.setInteger("TransferCooldown", this.transferCooldown);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.customName);
    }

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

示例11: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
    super.writeToNBT(tag);
    tag.setTag("Items", inventory.serializeNBT());
    tag.setByte("redstoneMode", (byte) redstoneMode);
    tag.setString("entityFilter", entityFilter);
    return tag;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:9,代碼來源:TileEntitySentryTurret.java

示例12: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound p_189510_1_)
{
    p_189510_1_.setString("Command", this.commandStored);
    p_189510_1_.setInteger("SuccessCount", this.successCount);
    p_189510_1_.setString("CustomName", this.customName);
    p_189510_1_.setBoolean("TrackOutput", this.trackOutput);

    if (this.lastOutput != null && this.trackOutput)
    {
        p_189510_1_.setString("LastOutput", ITextComponent.Serializer.componentToJson(this.lastOutput));
    }

    this.resultStats.writeStatsToNBT(p_189510_1_);
    return p_189510_1_;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:CommandBlockBaseLogic.java

示例13: createEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * create a new instance of an entity from NBT store
 */
public static Entity createEntityFromNBT(NBTTagCompound nbt, World worldIn)
{
    Entity entity = null;

    if ("Minecart".equals(nbt.getString("id")))
    {
        nbt.setString("id", EntityMinecart.EnumMinecartType.byNetworkID(nbt.getInteger("Type")).getName());
        nbt.removeTag("Type");
    }

    try
    {
        Class <? extends Entity > oclass = (Class)stringToClassMapping.get(nbt.getString("id"));

        if (oclass != null)
        {
            entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn});
        }
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
    }

    if (entity != null)
    {
        entity.readFromNBT(nbt);
    }
    else
    {
        logger.warn("Skipping Entity with id " + nbt.getString("id"));
    }

    return entity;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:39,代碼來源:EntityList.java

示例14: preInit

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static void preInit() {
	//Add soulforged steel as a liquid
	if (Loader.isModLoaded("betterwithmods")) {
		Fluid soulforgedSteel = new Fluid("soulforged_steel", new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
		FluidRegistry.registerFluid(soulforgedSteel);
		FluidRegistry.addBucketForFluid(soulforgedSteel);

		NBTTagCompound tag = new NBTTagCompound();
		tag.setString("fluid", soulforgedSteel.getName());
		tag.setString("ore", "SoulforgedSteel");
		tag.setBoolean("toolforge", false);
		FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);
	}
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:15,代碼來源:TConstructCompat.java

示例15: writeToNBT

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

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.customName);
    }

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


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