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


Java NBTTagCompound.getInteger方法代碼示例

本文整理匯總了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;
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:17,代碼來源:BloodCollector.java

示例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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:PotionEffect.java

示例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;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:SharedMonsterAttributes.java

示例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;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:11,代碼來源:TileEntityBanner.java

示例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"));
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:8,代碼來源:ItemPneumaticArmor.java

示例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);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:30,代碼來源:EntityArmorStand.java

示例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"))));
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:BlockJukebox.java

示例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");
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:8,代碼來源:TileEntityWitchAltar.java

示例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");
    }
 
開發者ID:ImbaKnugel,項目名稱:Whoosh,代碼行數:12,代碼來源:ItemTransporter.java

示例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");
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:8,代碼來源:DyeMixerTile.java

示例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);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:40,代碼來源:MapGenStructure.java

示例12: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound) {
    super.readFromNBT(nbtTagCompound);
    redstoneMode = nbtTagCompound.getInteger("redstoneMode");
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:6,代碼來源:TileEntityElectrostaticCompressor.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)
{
    super.readEntityFromNBT(compound);
    this.inLove = compound.getInteger("InLove");
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:9,代碼來源:EntityAnimal.java

示例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);
}
 
開發者ID:Zundrel,項目名稱:Never-Enough-Currency,代碼行數:26,代碼來源:TileEntityStockCrate.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.transferTicker = tagCompund.getInteger("TransferCooldown");
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:9,代碼來源:EntityMinecartHopper.java


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