当前位置: 首页>>代码示例>>Java>>正文


Java NBTTagCompound.setShort方法代码示例

本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.setShort方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.setShort方法的具体用法?Java NBTTagCompound.setShort怎么用?Java NBTTagCompound.setShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.nbt.NBTTagCompound的用法示例。


在下文中一共展示了NBTTagCompound.setShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setShort("BrewTime", (short)this.brewTime);
    NBTTagList nbttaglist = new NBTTagList();

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

    compound.setTag("Items", nbttaglist);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.customName);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:TileEntityBrewingStand.java

示例2: addEnchantment

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Adds an enchantment with a desired level on the ItemStack.
 */
public void addEnchantment(Enchantment ench, int level)
{
    if (this.stackTagCompound == null)
    {
        this.setTagCompound(new NBTTagCompound());
    }

    if (!this.stackTagCompound.hasKey("ench", 9))
    {
        this.stackTagCompound.setTag("ench", new NBTTagList());
    }

    NBTTagList nbttaglist = this.stackTagCompound.getTagList("ench", 10);
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.setShort("id", (short)ench.effectId);
    nbttagcompound.setShort("lvl", (short)((byte)level));
    nbttaglist.appendTag(nbttagcompound);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:ItemStack.java

示例3: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void writeToNBT(NBTTagCompound tagCompound) {
	super.tileEntityWriteToNBT(tagCompound);

	tagCompound.setShort("CurrentEnergy", (short) currentEnergy);
	NBTTagList tagList = new NBTTagList();

	for(int i = 0; i < machineItemStacks.length; ++i) {
		if(machineItemStacks[i] != null) {
			NBTTagCompound tagCompound1 = new NBTTagCompound();
			tagCompound1.setByte("Slot", (byte) i);
			machineItemStacks[i].writeToNBT(tagCompound1);
			tagList.appendTag(tagCompound1);
		}
	}
	tagCompound.setTag("Items", tagList);

	if(hasCustomInventoryName())
		tagCompound.setString("CustomName", machineName);
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:20,代码来源:TileEntityAutoWorkBench.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:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:EntityItem.java

示例5: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
	super.writeEntityToNBT(nbt);
	nbt.setBoolean("Hidden", this.hidden);
	if(hidden){
		nbt.setIntArray("HiddenPos", new int[]{this.hiddenBlock.getX(),this.hiddenBlock.getY(),this.hiddenBlock.getZ()});
		NBTTagList list=new NBTTagList();
		nbt.setTag("Props", list);
		for(BlockPos pos:this.usedPos)
			list.appendTag(new NBTTagIntArray(new int[]{pos.getX(),pos.getY(),pos.getZ()}));
	}
	nbt.setShort("Begin", (short)this.begin);
	nbt.setShort("Teleport", (short)this.teleportCooldown);
	nbt.setShort("BombCooldown", (short)this.bombCooldown);
	nbt.setShort("BombDuration", (short)this.bombDuration);
	nbt.setShort("TopBlock", (short)this.topBlock);
	nbt.setByte("HideCount", (byte)this.hideCount);
	nbt.setBoolean("Bomb", this.isBombSpell());
	
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:21,代码来源:EntityMerasmus.java

示例6: onHackFinished

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void onHackFinished(World world, BlockPos pos, EntityPlayer player) {
    if (!world.isRemote) {
        NBTTagCompound tag = new NBTTagCompound();
        TileEntity te = world.getTileEntity(pos);
        if (te != null) {
            te.writeToNBT(tag);
            tag.setShort("RequiredPlayerRange", (short) 0);
            te.readFromNBT(tag);
            IBlockState state = world.getBlockState(pos);
            world.notifyBlockUpdate(pos, state, state, 3);
        }
    }

}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:16,代码来源:HackableMobSpawner.java

示例7: 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

示例8: 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("xTile", (short)this.xTile);
    tagCompound.setShort("yTile", (short)this.yTile);
    tagCompound.setShort("zTile", (short)this.zTile);
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
    tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("shake", (byte)this.shake);
    tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:EntityFishHook.java

示例9: setEnchantments

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Set the enchantments for the specified stack.
 */
public static void setEnchantments(Map<Enchantment, Integer> enchMap, ItemStack stack)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (Entry<Enchantment, Integer> entry : enchMap.entrySet())
    {
        Enchantment enchantment = (Enchantment)entry.getKey();

        if (enchantment != null)
        {
            int i = ((Integer)entry.getValue()).intValue();
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setShort("id", (short)Enchantment.getEnchantmentID(enchantment));
            nbttagcompound.setShort("lvl", (short)i);
            nbttaglist.appendTag(nbttagcompound);

            if (stack.getItem() == Items.ENCHANTED_BOOK)
            {
                Items.ENCHANTED_BOOK.addEnchantment(stack, new EnchantmentData(enchantment, i));
            }
        }
    }

    if (nbttaglist.hasNoTags())
    {
        if (stack.hasTagCompound())
        {
            stack.getTagCompound().removeTag("ench");
        }
    }
    else if (stack.getItem() != Items.ENCHANTED_BOOK)
    {
        stack.setTagInfo("ench", nbttaglist);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:EnchantmentHelper.java

示例10: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Write the stack fields to a NBT object. Return the new NBT object.
 */
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
    ResourceLocation resourcelocation = (ResourceLocation)Item.itemRegistry.getNameForObject(this.item);
    nbt.setString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString());
    nbt.setByte("Count", (byte)this.stackSize);
    nbt.setShort("Damage", (short)this.itemDamage);

    if (this.stackTagCompound != null)
    {
        nbt.setTag("tag", this.stackTagCompound);
    }

    return nbt;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:ItemStack.java

示例11: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setFloat("HealF", this.getHealth());
    tagCompound.setShort("Health", (short)((int)Math.ceil((double)this.getHealth())));
    tagCompound.setShort("HurtTime", (short)this.hurtTime);
    tagCompound.setInteger("HurtByTimestamp", this.revengeTimer);
    tagCompound.setShort("DeathTime", (short)this.deathTime);
    tagCompound.setFloat("AbsorptionAmount", this.getAbsorptionAmount());

    for (ItemStack itemstack : this.getInventory())
    {
        if (itemstack != null)
        {
            this.attributeMap.removeAttributeModifiers(itemstack.getAttributeModifiers());
        }
    }

    tagCompound.setTag("Attributes", SharedMonsterAttributes.writeBaseAttributeMapToNBT(this.getAttributeMap()));

    for (ItemStack itemstack1 : this.getInventory())
    {
        if (itemstack1 != null)
        {
            this.attributeMap.applyAttributeModifiers(itemstack1.getAttributeModifiers());
        }
    }

    if (!this.activePotionsMap.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (PotionEffect potioneffect : this.activePotionsMap.values())
        {
            nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
        }

        tagCompound.setTag("ActiveEffects", nbttaglist);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:43,代码来源:EntityLivingBase.java

示例12: writeToFixedNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
protected NBTTagCompound writeToFixedNBT (NBTTagCompound tag) {
    tag = super.writeToFixedNBT(tag);

    tag.setShort("BurnTime", (short)furnaceBurnTime);
    tag.setShort("CookTime", (short)cookTime);
    tag.setShort("CookTimeTotal", (short)totalCookTime);

    ItemStackHelper.saveAllItems(tag, furnaceItemStacks);

    return tag;
}
 
开发者ID:jaquadro,项目名称:GardenStuff,代码行数:13,代码来源:TileBloomeryFurnace.java

示例13: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);
    compound.setShort("Anger", (short)this.angerLevel);

    if (this.angerTargetUUID != null)
    {
        compound.setString("HurtBy", this.angerTargetUUID.toString());
    }
    else
    {
        compound.setString("HurtBy", "");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:EntityPigZombie.java

示例14: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("minecraft:banner".equals(compound.getString("id")) && compound.hasKey("tag", 10))
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");

        if (nbttagcompound.hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");

            if (nbttagcompound1.hasKey("Base", 99))
            {
                compound.setShort("Damage", (short)(nbttagcompound1.getShort("Base") & 15));

                if (nbttagcompound.hasKey("display", 10))
                {
                    NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("display");

                    if (nbttagcompound2.hasKey("Lore", 9))
                    {
                        NBTTagList nbttaglist = nbttagcompound2.getTagList("Lore", 8);

                        if (nbttaglist.tagCount() == 1 && "(+NBT)".equals(nbttaglist.getStringTagAt(0)))
                        {
                            return compound;
                        }
                    }
                }

                nbttagcompound1.removeTag("Base");

                if (nbttagcompound1.hasNoTags())
                {
                    nbttagcompound.removeTag("BlockEntityTag");
                }

                if (nbttagcompound.hasNoTags())
                {
                    compound.removeTag("tag");
                }
            }
        }
    }

    return compound;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:47,代码来源:BannerItemColor.java

示例15: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void writeEntityToNBT(NBTTagCompound compound)
{
	super.writeEntityToNBT(compound);
	compound.setShort("Suspension", (short)suspension);
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:7,代码来源:EntityFakeStray.java


注:本文中的net.minecraft.nbt.NBTTagCompound.setShort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。