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


Java NBTTagCompound.getShort方法代碼示例

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


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

示例1: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    this.dataWatcher.updateObject(17, Byte.valueOf((byte)(tagCompund.getBoolean("powered") ? 1 : 0)));

    if (tagCompund.hasKey("Fuse", 99))
    {
        this.fuseTime = tagCompund.getShort("Fuse");
    }

    if (tagCompund.hasKey("ExplosionRadius", 99))
    {
        this.explosionRadius = tagCompund.getByte("ExplosionRadius");
    }

    if (tagCompund.getBoolean("ignited"))
    {
        this.ignite();
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:24,代碼來源:EntityCreeper.java

示例2: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound nbt) {
	super.readFromNBT(nbt);
	NBTTagList nbttaglist = nbt.getTagList("Items", 10);
	inventory = new ItemStack[getSizeInventory()];

	for (int i = 0; i < nbttaglist.tagCount(); i++) {
		NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
		byte b0 = nbt1.getByte("Slot");

		if (b0 >= 0 && b0 < inventory.length)
			inventory[b0] = ItemStack.loadItemStackFromNBT(nbt1);
	}

	brewTime = nbt.getShort("BrewTime");

	if (nbt.hasKey("Fuel", Constants.NBT.TAG_SHORT)) {
		fuel = nbt.getShort("Fuel");
		if (fuel > 0)
			currentFuel = 30;
	} else {
		fuel = nbt.getInteger("Fuel");
		currentFuel = nbt.getInteger("CurrentFuel");
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:26,代碼來源:TileEntityNewBrewingStand.java

示例3: getEnchantmentIdLevels

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private static int[][] getEnchantmentIdLevels(ItemStack p_getEnchantmentIdLevels_0_)
{
    Item item = p_getEnchantmentIdLevels_0_.getItem();
    NBTTagList nbttaglist = item == Items.enchanted_book ? Items.enchanted_book.getEnchantments(p_getEnchantmentIdLevels_0_) : p_getEnchantmentIdLevels_0_.getEnchantmentTagList();

    if (nbttaglist != null && nbttaglist.tagCount() > 0)
    {
        int[][] aint = new int[nbttaglist.tagCount()][2];

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            int j = nbttagcompound.getShort("id");
            int k = nbttagcompound.getShort("lvl");
            aint[i][0] = j;
            aint[i][1] = k;
        }

        return aint;
    }
    else
    {
        return EMPTY_INT2_ARRAY;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:CustomItems.java

示例4: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound tagCompound) {
	super.tileEntityReadFromNBT(tagCompound);
	NBTTagList tagList = tagCompound.getTagList("Items", 3);
	machineItemStacks = new ItemStack[getSizeInventory()];

	for(int i = 0; i < tagList.tagCount(); ++i) {
		NBTTagCompound tagCompund1 = tagList.getCompoundTagAt(i);
		byte b = tagCompund1.getByte("Slot");
		if(b >= 0 && b < machineItemStacks.length)
			machineItemStacks[b] = ItemStack.loadItemStackFromNBT(tagCompund1);
	}
	currentEnergy = tagCompound.getShort("CurrentEnergy");

	if(tagCompound.hasKey("CustomName", 8)) {
		machineName = tagCompound.getString("CustomName");
	}
}
 
開發者ID:viddeno,項目名稱:Technical,代碼行數:18,代碼來源:TileEntityAutoWorkBench.java

示例5: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.shake = tagCompund.getByte("shake") & 255;
    this.inGround = tagCompund.getByte("inGround") == 1;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:EntityFishHook.java

示例6: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if (compound.hasKey("id", 99))
    {
        short short1 = compound.getShort("id");

        if (short1 > 0 && short1 < ID_MAP.length && ID_MAP[short1] != null)
        {
            compound.setString("id", ID_MAP[short1]);
        }
    }

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

示例7: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.health = tagCompund.getShort("Health") & 255;
    this.age = tagCompund.getShort("Age");

    if (tagCompund.hasKey("PickupDelay"))
    {
        this.delayBeforeCanPickup = tagCompund.getShort("PickupDelay");
    }

    if (tagCompund.hasKey("Owner"))
    {
        this.owner = tagCompund.getString("Owner");
    }

    if (tagCompund.hasKey("Thrower"))
    {
        this.thrower = tagCompund.getString("Thrower");
    }

    NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item");
    this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound));

    if (this.getEntityItem() == null)
    {
        this.setDead();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:32,代碼來源:EntityItem.java

示例8: addEnchantment

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Adds an stored enchantment to an enchanted book ItemStack
 */
public void addEnchantment(ItemStack stack, EnchantmentData enchantment)
{
    NBTTagList nbttaglist = this.getEnchantments(stack);
    boolean flag = true;

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);

        if (nbttagcompound.getShort("id") == enchantment.enchantmentobj.effectId)
        {
            if (nbttagcompound.getShort("lvl") < enchantment.enchantmentLevel)
            {
                nbttagcompound.setShort("lvl", (short)enchantment.enchantmentLevel);
            }

            flag = false;
            break;
        }
    }

    if (flag)
    {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setShort("id", (short)enchantment.enchantmentobj.effectId);
        nbttagcompound1.setShort("lvl", (short)enchantment.enchantmentLevel);
        nbttaglist.appendTag(nbttagcompound1);
    }

    if (!stack.hasTagCompound())
    {
        stack.setTagCompound(new NBTTagCompound());
    }

    stack.getTagCompound().setTag("StoredEnchantments", nbttaglist);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:40,代碼來源:ItemEnchantedBook.java

示例9: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");
    this.ticksInGround = tagCompund.getShort("life");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.inData = tagCompund.getByte("inData") & 255;
    this.arrowShake = tagCompund.getByte("shake") & 255;
    this.inGround = tagCompund.getByte("inGround") == 1;

    if (tagCompund.hasKey("damage", 99))
    {
        this.damage = tagCompund.getDouble("damage");
    }

    if (tagCompund.hasKey("pickup", 99))
    {
        this.canBePickedUp = tagCompund.getByte("pickup");
    }
    else if (tagCompund.hasKey("player", 99))
    {
        this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:38,代碼來源:EntityArrow.java

示例10: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.throwableShake = tagCompund.getByte("shake") & 255;
    this.inGround = tagCompund.getByte("inGround") == 1;
    this.thrower = null;
    this.throwerName = tagCompund.getString("ownerName");

    if (this.throwerName != null && this.throwerName.length() == 0)
    {
        this.throwerName = null;
    }

    this.thrower = this.getThrower();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:31,代碼來源:EntityThrowable.java

示例11: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.inGround = tagCompund.getByte("inGround") == 1;

    if (tagCompund.hasKey("direction", 9))
    {
        NBTTagList nbttaglist = tagCompund.getTagList("direction", 6);
        this.motionX = nbttaglist.getDoubleAt(0);
        this.motionY = nbttaglist.getDoubleAt(1);
        this.motionZ = nbttaglist.getDoubleAt(2);
    }
    else
    {
        this.setDead();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:33,代碼來源:EntityFireball.java

示例12: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
protected void readEntityFromNBT(NBTTagCompound compound)
{
	this.lifetime = compound.getShort("Lifetime");
	String s = compound.getString("VictimUUID");
	if (!s.isEmpty())
	{
		this.victim = (EntityLivingBase)((WorldServer)this.world).getEntityFromUuid(UUID.fromString(s));
	}
}
 
開發者ID:crazysnailboy,項目名稱:Halloween,代碼行數:11,代碼來源:EntityCurse.java

示例13: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    this.xTile = compound.getInteger("xTile");
    this.yTile = compound.getInteger("yTile");
    this.zTile = compound.getInteger("zTile");
    this.ticksInGround = compound.getShort("life");

    if (compound.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(compound.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(compound.getByte("inTile") & 255);
    }

    this.inData = compound.getByte("inData") & 255;
    this.arrowShake = compound.getByte("shake") & 255;
    this.inGround = compound.getByte("inGround") == 1;

    if (compound.hasKey("damage", 99))
    {
        this.damage = compound.getDouble("damage");
    }

    if (compound.hasKey("pickup", 99))
    {
        this.pickupStatus = EntityArrow.PickupStatus.getByOrdinal(compound.getByte("pickup"));
    }
    else if (compound.hasKey("player", 99))
    {
        this.pickupStatus = compound.getBoolean("player") ? EntityArrow.PickupStatus.ALLOWED : EntityArrow.PickupStatus.DISALLOWED;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:38,代碼來源:EntityArrow.java

示例14: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.xpOrbHealth = tagCompund.getShort("Health") & 255;
    this.xpOrbAge = tagCompund.getShort("Age");
    this.xpValue = tagCompund.getShort("Value");
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:10,代碼來源:EntityXPOrb.java

示例15: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    this.pushX = tagCompund.getDouble("PushX");
    this.pushZ = tagCompund.getDouble("PushZ");
    this.fuel = tagCompund.getShort("Fuel");
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:11,代碼來源:EntityMinecartFurnace.java


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