當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。