当前位置: 首页>>代码示例>>Java>>正文


Java NBTTagCompound.hasKey方法代码示例

本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.hasKey方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.hasKey方法的具体用法?Java NBTTagCompound.hasKey怎么用?Java NBTTagCompound.hasKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.nbt.NBTTagCompound的用法示例。


在下文中一共展示了NBTTagCompound.hasKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	inventory.deserializeNBT(compound.getCompoundTag("inv"));
	isCooking = compound.getBoolean("cooking");
	fuelTimer = compound.getInteger("fuel");
	maxFuelTimer = compound.getInteger("max");

	NBTTagCompound connections = compound.getCompoundTag("connections");
	System.out.println("read "+connections);
	for (int i = 0; i < 4; i++)
		if(connections.hasKey(String.valueOf(i)))
		{
			BlockPos pos = BlockPos.fromLong(connections.getLong(String.valueOf(i)));
			connected.add(pos);
		}
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:18,代码来源:TileEntityRange.java

示例2: 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.getBoolean("IsBaby"))
    {
        this.setChild(true);
    }

    if (tagCompund.getBoolean("IsVillager"))
    {
        this.setVillager(true);
    }

    if (tagCompund.hasKey("ConversionTime", 99) && tagCompund.getInteger("ConversionTime") > -1)
    {
        this.startConversion(tagCompund.getInteger("ConversionTime"));
    }

    this.setBreakDoorsAItask(tagCompund.getBoolean("CanBreakDoors"));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:EntityZombie.java

示例3: readCapabilitiesFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readCapabilitiesFromNBT(NBTTagCompound tagCompound)
{
    if (tagCompound.hasKey("abilities", 10))
    {
        NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("abilities");
        this.disableDamage = nbttagcompound.getBoolean("invulnerable");
        this.isFlying = nbttagcompound.getBoolean("flying");
        this.allowFlying = nbttagcompound.getBoolean("mayfly");
        this.isCreativeMode = nbttagcompound.getBoolean("instabuild");

        if (nbttagcompound.hasKey("flySpeed", 99))
        {
            this.flySpeed = nbttagcompound.getFloat("flySpeed");
            this.walkSpeed = nbttagcompound.getFloat("walkSpeed");
        }

        if (nbttagcompound.hasKey("mayBuild", 1))
        {
            this.allowEdit = nbttagcompound.getBoolean("mayBuild");
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:PlayerCapabilities.java

示例4: 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

示例5: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    NBTTagList nbttaglist = compound.getTagList("Items", 10);
    this.chestContents = new ItemStack[this.getSizeInventory()];

    if (compound.hasKey("CustomName", 8))
    {
        this.customName = compound.getString("CustomName");
    }

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;

        if (j >= 0 && j < this.chestContents.length)
        {
            this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:TileEntityChest.java

示例6: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);

	NBTTagCompound nbt = compound.getCompoundTag(TAG_NAME);
	setRedstoneMode(RedstoneMode.values()[nbt.getInteger(TAG_REDSTONEMODE)]);
	setRSSignal(nbt.getBoolean(TAG_HAS_REDSTONE_SIGNAL));
	NBTTagCompound itemNBT = compound.getCompoundTag(TAG_ITEMSTACK);
	ItemStack newStack = itemNBT == null ? ItemStack.EMPTY : new ItemStack(itemNBT);
	setStack(newStack);
	setExtractionMode(ExtractionMode.values()[compound.getInteger(TAG_EXTRACTMODE)]);
	if (compound.hasKey(TAG_SELECTEDSTACK) && getExtractionMode() == ExtractionMode.SELECTED) {
		setSelectedStack(new ItemStack(compound.getCompoundTag(TAG_SELECTEDSTACK)));
	}

}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:17,代码来源:TileDankNullDock.java

示例7: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    extension = tag.getFloat("extension");
    targetExtension = tag.getFloat("targetExtension");
    redstoneMode = tag.getInteger("redstoneMode");
    if (!tag.hasKey("maxFloorHeight")) {//backwards compatibility implementation.
        updateMaxElevatorHeight();
    } else {
        maxFloorHeight = tag.getInteger("maxFloorHeight");
    }
    for (int i = 0; i < 6; i++) {
        sidesConnected[i] = tag.getBoolean("sideConnected" + i);
    }
    camoStack = ICamouflageableTE.readCamoStackFromNBT(tag);
    camoState = ICamouflageableTE.getStateForStack(camoStack);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:TileEntityElevatorBase.java

示例8: processInventory

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static NBTTagCompound processInventory(IDataFixer fixer, NBTTagCompound compound, int version, String key)
{
    if (compound.hasKey(key, 9))
    {
        NBTTagList nbttaglist = compound.getTagList(key, 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            nbttaglist.set(i, fixer.process(FixTypes.ITEM_INSTANCE, nbttaglist.getCompoundTagAt(i), version));
        }
    }

    return compound;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:DataFixesManager.java

示例9: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);

    if (compound.hasKey("CustomName", 8))
    {
        this.customName = compound.getString("CustomName");
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:TileEntityEnchantmentTable.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)
{
    super.readEntityFromNBT(tagCompund);

    if (tagCompund.hasKey("SkeletonType", 99))
    {
        int i = tagCompund.getByte("SkeletonType");
        this.setSkeletonType(i);
    }

    this.setCombatTask();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:EntitySkeleton.java

示例11: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    NBTTagList list = compound.getTagList("Items", 10);
    for (int i = 0; i < list.tagCount(); ++i) {
        NBTTagCompound stackTag = list.getCompoundTagAt(i);
        int slot = stackTag.getByte("Slot") & 255;
        this.setInventorySlotContents(slot, new ItemStack(compound));
    }

    if (compound.hasKey("CustomName", 8)) {
        this.setCustomName(compound.getString("CustomName"));
    }
}
 
开发者ID:inifire201,项目名称:MagicWinds,代码行数:15,代码来源:TileEntityTrinketMaker.java

示例12: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag) {
	super.readFromNBT(tag);
	
	if (tag.hasKey("heatstorage")) {
		Thermionics.CAPABILITY_HEATSTORAGE.readNBT(heatStorage, null, tag.getTag("heatstorage"));
	}
	if (tag.hasKey("inventory")) {
		CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(itemStorage, null, tag.getTag("inventory"));
	}
	
	if (tag.hasKey("progress")) progress = tag.getInteger("progress");
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:14,代码来源:TileEntityOven.java

示例13: 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:SkidJava,项目名称:BaseClient,代码行数:30,代码来源:EntityArmorStand.java

示例14: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
    super.readEntityFromNBT(compound);
    if (compound.hasKey("SausageDiamondLayTime"))
    {
        this.timeToDiamond = compound.getInteger("SausageDiamondLayTime");
    }
}
 
开发者ID:OCDiary,项目名称:TheOink,代码行数:9,代码来源:OinkSausage.java

示例15: 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);

    if (compound.hasKey("CanPickUpLoot", 1))
    {
        this.setCanPickUpLoot(compound.getBoolean("CanPickUpLoot"));
    }

    this.persistenceRequired = compound.getBoolean("PersistenceRequired");

    if (compound.hasKey("ArmorItems", 9))
    {
        NBTTagList nbttaglist = compound.getTagList("ArmorItems", 10);

        for (int i = 0; i < this.inventoryArmor.size(); ++i)
        {
            this.inventoryArmor.set(i, new ItemStack(nbttaglist.getCompoundTagAt(i)));
        }
    }

    if (compound.hasKey("HandItems", 9))
    {
        NBTTagList nbttaglist1 = compound.getTagList("HandItems", 10);

        for (int j = 0; j < this.inventoryHands.size(); ++j)
        {
            this.inventoryHands.set(j, new ItemStack(nbttaglist1.getCompoundTagAt(j)));
        }
    }

    if (compound.hasKey("ArmorDropChances", 9))
    {
        NBTTagList nbttaglist2 = compound.getTagList("ArmorDropChances", 5);

        for (int k = 0; k < nbttaglist2.tagCount(); ++k)
        {
            this.inventoryArmorDropChances[k] = nbttaglist2.getFloatAt(k);
        }
    }

    if (compound.hasKey("HandDropChances", 9))
    {
        NBTTagList nbttaglist3 = compound.getTagList("HandDropChances", 5);

        for (int l = 0; l < nbttaglist3.tagCount(); ++l)
        {
            this.inventoryHandsDropChances[l] = nbttaglist3.getFloatAt(l);
        }
    }

    this.isLeashed = compound.getBoolean("Leashed");

    if (this.isLeashed && compound.hasKey("Leash", 10))
    {
        this.leashNBTTag = compound.getCompoundTag("Leash");
    }

    this.setLeftHanded(compound.getBoolean("LeftHanded"));

    if (compound.hasKey("DeathLootTable", 8))
    {
        this.deathLootTable = new ResourceLocation(compound.getString("DeathLootTable"));
        this.deathLootTableSeed = compound.getLong("DeathLootTableSeed");
    }

    this.setNoAI(compound.getBoolean("NoAI"));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:72,代码来源:EntityLiving.java


注:本文中的net.minecraft.nbt.NBTTagCompound.hasKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。