本文整理匯總了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();
}
}
示例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");
}
}
示例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;
}
}
示例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");
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
示例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;
}
}
示例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();
}
示例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();
}
}
示例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));
}
}
示例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;
}
}
示例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");
}
示例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");
}