本文整理匯總了Java中net.minecraft.nbt.NBTTagCompound.getInteger方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTTagCompound.getInteger方法的具體用法?Java NBTTagCompound.getInteger怎麽用?Java NBTTagCompound.getInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.getInteger方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fill
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public boolean fill(EntityPlayer player, EnumHand hand, int amount)
{
boolean flag = false;
ItemStack stack = player.getHeldItem(hand);
NBTTagCompound nbt = getNBT(stack);
if(nbt.getInteger("Blood") + amount <= 50)
{
nbt.setInteger("Blood", nbt.getInteger("Blood") + amount);
flag = true;
}
stack.setItemDamage(metaChange(nbt));
stack.setTagCompound(nbt);
player.setHeldItem(hand, stack);
return flag;
}
示例2: readCustomPotionEffectFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* Read a custom potion effect from a potion item's NBT data.
*/
public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt)
{
int i = nbt.getByte("Id");
if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null)
{
int j = nbt.getByte("Amplifier");
int k = nbt.getInteger("Duration");
boolean flag = nbt.getBoolean("Ambient");
boolean flag1 = true;
if (nbt.hasKey("ShowParticles", 1))
{
flag1 = nbt.getBoolean("ShowParticles");
}
return new PotionEffect(i, k, j, flag, flag1);
}
else
{
return null;
}
}
示例3: readAttributeModifierFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* Creates an AttributeModifier from an NBTTagCompound
*/
public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound p_111259_0_)
{
UUID uuid = new UUID(p_111259_0_.getLong("UUIDMost"), p_111259_0_.getLong("UUIDLeast"));
try
{
return new AttributeModifier(uuid, p_111259_0_.getString("Name"), p_111259_0_.getDouble("Amount"), p_111259_0_.getInteger("Operation"));
}
catch (Exception exception)
{
logger.warn("Unable to create attribute: " + exception.getMessage());
return null;
}
}
示例4: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
this.baseColor = compound.getInteger("Base");
this.patterns = compound.getTagList("Patterns", 10);
this.patternList = null;
this.colorList = null;
this.patternResourceLocation = null;
this.field_175119_g = true;
}
示例5: getSearchedStack
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Nonnull
public static ItemStack getSearchedStack(ItemStack helmetStack) {
if (helmetStack.isEmpty() || !NBTUtil.hasTag(helmetStack, "SearchStack")) return ItemStack.EMPTY;
NBTTagCompound tag = NBTUtil.getCompoundTag(helmetStack, "SearchStack");
if (tag.getInteger("itemID") == -1) return ItemStack.EMPTY;
return new ItemStack(Item.getItemById(tag.getInteger("itemID")), 1, tag.getInteger("itemDamage"));
}
示例6: 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);
if (tagCompund.hasKey("Equipment", 9))
{
NBTTagList nbttaglist = tagCompund.getTagList("Equipment", 10);
for (int i = 0; i < this.contents.length; ++i)
{
this.contents[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));
}
}
this.setInvisible(tagCompund.getBoolean("Invisible"));
this.setSmall(tagCompund.getBoolean("Small"));
this.setShowArms(tagCompund.getBoolean("ShowArms"));
this.disabledSlots = tagCompund.getInteger("DisabledSlots");
this.setNoGravity(tagCompund.getBoolean("NoGravity"));
this.setNoBasePlate(tagCompund.getBoolean("NoBasePlate"));
this.func_181027_m(tagCompund.getBoolean("Marker"));
this.field_181028_bj = !this.func_181026_s();
this.noClip = this.hasNoGravity();
NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Pose");
this.writePoseToNBT(nbttagcompound);
}
示例7: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
if (compound.hasKey("RecordItem", 10))
{
this.setRecord(new ItemStack(compound.getCompoundTag("RecordItem")));
}
else if (compound.getInteger("Record") > 0)
{
this.setRecord(new ItemStack(Item.getItemById(compound.getInteger("Record"))));
}
}
示例8: readDataNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
protected void readDataNBT(NBTTagCompound tag) {
power = tag.getInteger("power");
maxPower = tag.getInteger("maxPower");
gain = tag.getInteger("gain");
color = tag.getInteger("color");
}
示例9: getSelected
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static int getSelected(ItemStack stack) {
if(!stack.hasTagCompound())
return -1;
NBTTagCompound tag = stack.getTagCompound();
if(!tag.hasKey("Selected"))
return -1;
return tag.getInteger("Selected");
}
示例10: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
if (compound.hasKey("R")) r = compound.getInteger("R");
if (compound.hasKey("G")) g = compound.getInteger("G");
if (compound.hasKey("B")) b = compound.getInteger("B");
}
示例11: initializeStructureData
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
protected void initializeStructureData(World worldIn)
{
if (this.structureData == null)
{
this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());
if (this.structureData == null)
{
this.structureData = new MapGenStructureData(this.getStructureName());
worldIn.setItemData(this.getStructureName(), this.structureData);
}
else
{
NBTTagCompound nbttagcompound = this.structureData.getTagCompound();
for (String s : nbttagcompound.getKeySet())
{
NBTBase nbtbase = nbttagcompound.getTag(s);
if (nbtbase.getId() == 10)
{
NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;
if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
{
int i = nbttagcompound1.getInteger("ChunkX");
int j = nbttagcompound1.getInteger("ChunkZ");
StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);
if (structurestart != null)
{
this.structureMap.put(ChunkPos.asLong(i, j), structurestart);
}
}
}
}
}
}
}
示例12: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);
redstoneMode = nbtTagCompound.getInteger("redstoneMode");
}
示例13: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
this.inLove = compound.getInteger("InLove");
}
示例14: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
ownerUUID = UUID.fromString(compound.getString("ownerUUID"));
amount = compound.getFloat("amount");
shopControllerPos = new BlockPos(compound.getInteger("shopx"), compound.getInteger("shopy"), compound.getInteger("shopz"));
NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < items.tagCount(); ++i) {
NBTTagCompound item = items.getCompoundTagAt(i);
int slot = item.getInteger("Slot");
if (slot >= 0 && slot < getSizeInventory()) {
inventory.set(slot, new ItemStack(item));
}
}
NBTTagCompound type = compound.getCompoundTag("type");
this.type = new ItemStack(type);
}
示例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.transferTicker = tagCompund.getInteger("TransferCooldown");
}