当前位置: 首页>>代码示例>>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;未经允许,请勿转载。