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


Java NBTTagCompound.setInteger方法代碼示例

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


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

示例1: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound tagCompound)
{
    Block block = this.fallTile != null ? this.fallTile.getBlock() : Blocks.air;
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(block);
    tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile));
    tagCompound.setByte("Time", (byte)this.fallTime);
    tagCompound.setBoolean("DropItem", this.shouldDropItem);
    tagCompound.setBoolean("HurtEntities", this.hurtEntities);
    tagCompound.setFloat("FallHurtAmount", this.fallHurtAmount);
    tagCompound.setInteger("FallHurtMax", this.fallHurtMax);

    if (this.tileEntityData != null)
    {
        tagCompound.setTag("TileEntityData", this.tileEntityData);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityFallingBlock.java

示例2: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound compound)
{
    String s = (String)classToNameMap.get(this.getClass());

    if (s == null)
    {
        throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!");
    }
    else
    {
        compound.setString("id", s);
        compound.setInteger("x", this.pos.getX());
        compound.setInteger("y", this.pos.getY());
        compound.setInteger("z", this.pos.getZ());
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:TileEntity.java

示例3: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Nonnull
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
	compound = super.writeToNBT(compound);
	if (sapInBucket != null) {
		sapInBucket.writeToNBT(compound);
		compound.setInteger("direction", direction.getIndex());
		compound.setInteger("sappertick", LIQUID_AMOUNT);
	}
	return compound;
}
 
開發者ID:MinecraftModDevelopmentMods,項目名稱:Got-Wood,代碼行數:12,代碼來源:TileEntityTreeTap.java

示例4: checkedReadChunkFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Wraps readChunkFromNBT. Checks the coordinates and several NBT tags.
 */
protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_)
{
    if (!p_75822_4_.hasKey("Level", 10))
    {
        logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping");
        return null;
    }
    else
    {
        NBTTagCompound nbttagcompound = p_75822_4_.getCompoundTag("Level");

        if (!nbttagcompound.hasKey("Sections", 9))
        {
            logger.error("Chunk file at " + x + "," + z + " is missing block data, skipping");
            return null;
        }
        else
        {
            Chunk chunk = this.readChunkFromNBT(worldIn, nbttagcompound);

            if (!chunk.isAtLocation(x, z))
            {
                logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")");
                nbttagcompound.setInteger("xPos", x);
                nbttagcompound.setInteger("zPos", z);
                chunk = this.readChunkFromNBT(worldIn, nbttagcompound);
            }

            return chunk;
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:36,代碼來源:AnvilChunkLoader.java

示例5: saveFlags

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Save flags to file
 * @throws IOException If flags failed to save
 */
private void saveFlags() throws IOException {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setInteger("Version", VERSION);
    tag.setShort("Width", (short)getWidth());
    tag.setShort("Height", (short)getHeight());
    tag.setShort("Length", (short)getLength());
    tag.setLong("SchemaLen", getSchemaLen());
    tag.setInteger("Lift", getLift());
    tag.setInteger("Method", getMethod().getValue());
    tag.setInteger("Biome", getBiomus().getValue());
    Utils.writeTags(getFileFlag(), tag);
}
 
開發者ID:ternsip,項目名稱:StructPro,代碼行數:17,代碼來源:Structure.java

示例6: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound compound)
{
    if (this.hasDisplayTile())
    {
        compound.setBoolean("CustomDisplayTile", true);
        IBlockState iblockstate = this.getDisplayTile();
        ResourceLocation resourcelocation = (ResourceLocation)Block.REGISTRY.getNameForObject(iblockstate.getBlock());
        compound.setString("DisplayTile", resourcelocation == null ? "" : resourcelocation.toString());
        compound.setInteger("DisplayData", iblockstate.getBlock().getMetaFromState(iblockstate));
        compound.setInteger("DisplayOffset", this.getDisplayTileOffset());
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:EntityMinecart.java

示例7: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);
    compound.setInteger("TransferCooldown", this.transferTicker);
    compound.setBoolean("Enabled", this.isBlocked);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:10,代碼來源:EntityMinecartHopper.java

示例8: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeToNBT(NBTTagCompound tag) {
    NBTTagCompound pneumaticTag = new NBTTagCompound();
    pneumaticTag.setInteger("air", air);
    pneumaticTag.setInteger("volume", volume);
    pneumaticTag.setFloat("maxPressure", maxPressure);
    tag.setTag("pneumatic", pneumaticTag);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:9,代碼來源:AirHandler.java

示例9: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);
    compound.setTag("animalData", this.animalCapability.serializeNBT());
    compound.setLong("age", this.getDataManager().get(PARAM_AGE));
    compound.setBoolean("gender", this.getDataManager().get(PARAM_GENDER));
    compound.setInteger("pregnancy", this.getDataManager().get(PARAM_PREGNANCY));
    compound.setBoolean("domesticated", this.getDataManager().get(PARAM_DOMESTICATED));
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:11,代碼來源:EntityAnimal.java

示例10: writeStructureToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setBoolean("hr", this.hasRails);
    tagCompound.setBoolean("sc", this.hasSpiders);
    tagCompound.setBoolean("hps", this.spawnerPlaced);
    tagCompound.setInteger("Num", this.sectionCount);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:StructureMineshaftPieces.java

示例11: getTabIconItem

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public ItemStack getTabIconItem()
{
	NBTTagCompound tags =  new NBTTagCompound();
	tags.setInteger("pos1_x", 1);
	ItemStack stack = new ItemStack(AnimaItems.LINKER);
	stack.setTagCompound(tags);
	return stack;
}
 
開發者ID:Lemonszz,項目名稱:Anima-Mundi,代碼行數:10,代碼來源:AnimaTab.java

示例12: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeEntityToNBT(NBTTagCompound compound) {
    super.writeEntityToNBT(compound);
    NBTTagCompound sub = new NBTTagCompound();
    sub.setUniqueId("id", this.id);
    sub.setInteger("index", this.index);
    sub.setBoolean("hadEffect", this.hadEffect);
    sub.setBoolean("hasEffect", this.hasEffect);
    compound.setTag("randores", sub);
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:11,代碼來源:RandoresArrow.java

示例13: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT() {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setInteger("type", type.ordinal());
    tag.setInteger("facing", facing.ordinal());
    tag.setString("ioInfo", ioInfo.name());
    return tag;
}
 
開發者ID:jaredlll08,項目名稱:Machines-and-Stuff,代碼行數:8,代碼來源:AccumulatorInfo.java

示例14: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities
 */
public void writeToNBT(NBTTagCompound nbt)
{
    nbt.setByte("dimension", this.dimension);
    nbt.setInteger("xCenter", this.xCenter);
    nbt.setInteger("zCenter", this.zCenter);
    nbt.setByte("scale", this.scale);
    nbt.setShort("width", (short)128);
    nbt.setShort("height", (short)128);
    nbt.setByteArray("colors", this.colors);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:14,代碼來源:MapData.java

示例15: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
    Template.BasicPalette template$basicpalette = new Template.BasicPalette();
    NBTTagList nbttaglist = new NBTTagList();

    for (Template.BlockInfo template$blockinfo : this.blocks)
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setTag("pos", this.writeInts(new int[] {template$blockinfo.pos.getX(), template$blockinfo.pos.getY(), template$blockinfo.pos.getZ()}));
        nbttagcompound.setInteger("state", template$basicpalette.idFor(template$blockinfo.blockState));

        if (template$blockinfo.tileentityData != null)
        {
            nbttagcompound.setTag("nbt", template$blockinfo.tileentityData);
        }

        nbttaglist.appendTag(nbttagcompound);
    }

    NBTTagList nbttaglist1 = new NBTTagList();

    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setTag("pos", this.writeDoubles(new double[] {template$entityinfo.pos.xCoord, template$entityinfo.pos.yCoord, template$entityinfo.pos.zCoord}));
        nbttagcompound1.setTag("blockPos", this.writeInts(new int[] {template$entityinfo.blockPos.getX(), template$entityinfo.blockPos.getY(), template$entityinfo.blockPos.getZ()}));

        if (template$entityinfo.entityData != null)
        {
            nbttagcompound1.setTag("nbt", template$entityinfo.entityData);
        }

        nbttaglist1.appendTag(nbttagcompound1);
    }

    NBTTagList nbttaglist2 = new NBTTagList();

    for (IBlockState iblockstate : template$basicpalette)
    {
        nbttaglist2.appendTag(NBTUtil.writeBlockState(new NBTTagCompound(), iblockstate));
    }

    nbt.setTag("palette", nbttaglist2);
    nbt.setTag("blocks", nbttaglist);
    nbt.setTag("entities", nbttaglist1);
    nbt.setTag("size", this.writeInts(new int[] {this.size.getX(), this.size.getY(), this.size.getZ()}));
    nbt.setString("author", this.author);
    nbt.setInteger("DataVersion", 922);
    return nbt;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:51,代碼來源:Template.java


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