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