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


Java NBTTagList.getFloatAt方法代碼示例

本文整理匯總了Java中net.minecraft.nbt.NBTTagList.getFloatAt方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTTagList.getFloatAt方法的具體用法?Java NBTTagList.getFloatAt怎麽用?Java NBTTagList.getFloatAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.nbt.NBTTagList的用法示例。


在下文中一共展示了NBTTagList.getFloatAt方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fixTagCompound

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if (compound.hasKey("HandDropChances", 9))
    {
        NBTTagList nbttaglist = compound.getTagList("HandDropChances", 5);

        if (nbttaglist.tagCount() == 2 && nbttaglist.getFloatAt(0) == 0.0F && nbttaglist.getFloatAt(1) == 0.0F)
        {
            compound.removeTag("HandDropChances");
        }
    }

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

        if (nbttaglist1.tagCount() == 4 && nbttaglist1.getFloatAt(0) == 0.0F && nbttaglist1.getFloatAt(1) == 0.0F && nbttaglist1.getFloatAt(2) == 0.0F && nbttaglist1.getFloatAt(3) == 0.0F)
        {
            compound.removeTag("ArmorDropChances");
        }
    }

    return compound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:RedundantChanceTags.java

示例2: readEntityFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);

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

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

    if (tagCompund.hasKey("Equipment", 9))
    {
        NBTTagList nbttaglist = tagCompund.getTagList("Equipment", 10);

        for (int i = 0; i < this.equipment.length; ++i)
        {
            this.equipment[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));
        }
    }

    if (tagCompund.hasKey("DropChances", 9))
    {
        NBTTagList nbttaglist1 = tagCompund.getTagList("DropChances", 5);

        for (int j = 0; j < nbttaglist1.tagCount(); ++j)
        {
            this.equipmentDropChances[j] = nbttaglist1.getFloatAt(j);
        }
    }

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

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

    this.setNoAI(tagCompund.getBoolean("NoAI"));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:44,代碼來源:EntityLiving.java

示例3: readFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * Reads the entity from NBT (calls an abstract helper method to read specialized data)
 */
public void readFromNBT(NBTTagCompound tagCompund)
{
    try
    {
        NBTTagList nbttaglist = tagCompund.getTagList("Pos", 6);
        NBTTagList nbttaglist1 = tagCompund.getTagList("Motion", 6);
        NBTTagList nbttaglist2 = tagCompund.getTagList("Rotation", 5);
        this.motionX = nbttaglist1.getDoubleAt(0);
        this.motionY = nbttaglist1.getDoubleAt(1);
        this.motionZ = nbttaglist1.getDoubleAt(2);

        if (Math.abs(this.motionX) > 10.0D)
        {
            this.motionX = 0.0D;
        }

        if (Math.abs(this.motionY) > 10.0D)
        {
            this.motionY = 0.0D;
        }

        if (Math.abs(this.motionZ) > 10.0D)
        {
            this.motionZ = 0.0D;
        }

        this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.getDoubleAt(0);
        this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.getDoubleAt(1);
        this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.getDoubleAt(2);
        this.prevRotationYaw = this.rotationYaw = nbttaglist2.getFloatAt(0);
        this.prevRotationPitch = this.rotationPitch = nbttaglist2.getFloatAt(1);
        this.setRotationYawHead(this.rotationYaw);
        this.func_181013_g(this.rotationYaw);
        this.fallDistance = tagCompund.getFloat("FallDistance");
        this.fire = tagCompund.getShort("Fire");
        this.setAir(tagCompund.getShort("Air"));
        this.onGround = tagCompund.getBoolean("OnGround");
        this.dimension = tagCompund.getInteger("Dimension");
        this.invulnerable = tagCompund.getBoolean("Invulnerable");
        this.timeUntilPortal = tagCompund.getInteger("PortalCooldown");

        if (tagCompund.hasKey("UUIDMost", 4) && tagCompund.hasKey("UUIDLeast", 4))
        {
            this.entityUniqueID = new UUID(tagCompund.getLong("UUIDMost"), tagCompund.getLong("UUIDLeast"));
        }
        else if (tagCompund.hasKey("UUID", 8))
        {
            this.entityUniqueID = UUID.fromString(tagCompund.getString("UUID"));
        }

        this.setPosition(this.posX, this.posY, this.posZ);
        this.setRotation(this.rotationYaw, this.rotationPitch);

        if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0)
        {
            this.setCustomNameTag(tagCompund.getString("CustomName"));
        }

        this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible"));
        this.cmdResultStats.readStatsFromNBT(tagCompund);
        this.setSilent(tagCompund.getBoolean("Silent"));
        this.readEntityFromNBT(tagCompund);

        if (this.shouldSetPosAfterLoading())
        {
            this.setPosition(this.posX, this.posY, this.posZ);
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Loading entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being loaded");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:80,代碼來源:Entity.java

示例4: Rotations

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public Rotations(NBTTagList nbt)
{
    this.x = nbt.getFloatAt(0);
    this.y = nbt.getFloatAt(1);
    this.z = nbt.getFloatAt(2);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:7,代碼來源:Rotations.java

示例5: readEntityFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的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

示例6: readEntityFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的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.length; ++i)
        {
            this.inventoryArmor[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));
        }
    }

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

        for (int j = 0; j < this.inventoryHands.length; ++j)
        {
            this.inventoryHands[j] = ItemStack.loadItemStackFromNBT(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:F1r3w477,項目名稱:CustomWorldGen,代碼行數:72,代碼來源:EntityLiving.java


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