當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。