本文整理匯總了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;
}
示例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;
}
}
示例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;
}
示例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()));
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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_;
}
示例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;
}
示例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);
}
}
示例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;
}