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


Java NBTTagList.getDoubleAt方法代碼示例

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


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

示例1: readEntityFromNBT

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

    if (tagCompund.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.inGround = tagCompund.getByte("inGround") == 1;

    if (tagCompund.hasKey("direction", 9))
    {
        NBTTagList nbttaglist = tagCompund.getTagList("direction", 6);
        this.motionX = nbttaglist.getDoubleAt(0);
        this.motionY = nbttaglist.getDoubleAt(1);
        this.motionZ = nbttaglist.getDoubleAt(2);
    }
    else
    {
        this.setDead();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:33,代碼來源:EntityFireball.java

示例2: readEntityFromNBT

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    if (compound.hasKey("power", 9))
    {
        NBTTagList nbttaglist = compound.getTagList("power", 6);

        if (nbttaglist.tagCount() == 3)
        {
            this.accelerationX = nbttaglist.getDoubleAt(0);
            this.accelerationY = nbttaglist.getDoubleAt(1);
            this.accelerationZ = nbttaglist.getDoubleAt(2);
        }
    }

    this.ticksAlive = compound.getInteger("life");

    if (compound.hasKey("direction", 9) && compound.getTagList("direction", 6).tagCount() == 3)
    {
        NBTTagList nbttaglist1 = compound.getTagList("direction", 6);
        this.motionX = nbttaglist1.getDoubleAt(0);
        this.motionY = nbttaglist1.getDoubleAt(1);
        this.motionZ = nbttaglist1.getDoubleAt(2);
    }
    else
    {
        this.setDead();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:32,代碼來源:EntityFireball.java

示例3: read

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void read(NBTTagCompound compound)
{
    this.blocks.clear();
    this.entities.clear();
    NBTTagList nbttaglist = compound.getTagList("size", 3);
    this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
    this.author = compound.getString("author");
    BasicPalette template$basicpalette = new BasicPalette();
    NBTTagList nbttaglist1 = compound.getTagList("palette", 10);

    for (int i = 0; i < nbttaglist1.tagCount(); ++i)
    {
        template$basicpalette.addMapping(NBTUtil.readBlockState(nbttaglist1.getCompoundTagAt(i)), i);
    }

    NBTTagList nbttaglist3 = compound.getTagList("blocks", 10);

    for (int j = 0; j < nbttaglist3.tagCount(); ++j)
    {
        NBTTagCompound nbttagcompound = nbttaglist3.getCompoundTagAt(j);
        NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
        BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
        IBlockState iblockstate = template$basicpalette.stateFor(nbttagcompound.getInteger("state"));
        NBTTagCompound nbttagcompound1;

        if (nbttagcompound.hasKey("nbt"))
        {
            nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
        }
        else
        {
            nbttagcompound1 = null;
        }

        this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
    }

    NBTTagList nbttaglist4 = compound.getTagList("entities", 10);

    for (int k = 0; k < nbttaglist4.tagCount(); ++k)
    {
        NBTTagCompound nbttagcompound3 = nbttaglist4.getCompoundTagAt(k);
        NBTTagList nbttaglist5 = nbttagcompound3.getTagList("pos", 6);
        Vec3d vec3d = new Vec3d(nbttaglist5.getDoubleAt(0), nbttaglist5.getDoubleAt(1), nbttaglist5.getDoubleAt(2));
        NBTTagList nbttaglist6 = nbttagcompound3.getTagList("blockPos", 3);
        BlockPos blockpos1 = new BlockPos(nbttaglist6.getIntAt(0), nbttaglist6.getIntAt(1), nbttaglist6.getIntAt(2));

        if (nbttagcompound3.hasKey("nbt"))
        {
            NBTTagCompound nbttagcompound2 = nbttagcompound3.getCompoundTag("nbt");
            this.entities.add(new Template.EntityInfo(vec3d, blockpos1, nbttagcompound2));
        }
    }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:55,代碼來源:HarshenTemplate.java

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

示例5: read

import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void read(NBTTagCompound compound)
{
    this.blocks.clear();
    this.entities.clear();
    NBTTagList nbttaglist = compound.getTagList("size", 3);
    this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
    this.author = compound.getString("author");
    Template.BasicPalette template$basicpalette = new Template.BasicPalette();
    NBTTagList nbttaglist1 = compound.getTagList("palette", 10);

    for (int i = 0; i < nbttaglist1.tagCount(); ++i)
    {
        template$basicpalette.addMapping(NBTUtil.readBlockState(nbttaglist1.getCompoundTagAt(i)), i);
    }

    NBTTagList nbttaglist3 = compound.getTagList("blocks", 10);

    for (int j = 0; j < nbttaglist3.tagCount(); ++j)
    {
        NBTTagCompound nbttagcompound = nbttaglist3.getCompoundTagAt(j);
        NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
        BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
        IBlockState iblockstate = template$basicpalette.stateFor(nbttagcompound.getInteger("state"));
        NBTTagCompound nbttagcompound1;

        if (nbttagcompound.hasKey("nbt"))
        {
            nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
        }
        else
        {
            nbttagcompound1 = null;
        }

        this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
    }

    NBTTagList nbttaglist4 = compound.getTagList("entities", 10);

    for (int k = 0; k < nbttaglist4.tagCount(); ++k)
    {
        NBTTagCompound nbttagcompound3 = nbttaglist4.getCompoundTagAt(k);
        NBTTagList nbttaglist5 = nbttagcompound3.getTagList("pos", 6);
        Vec3d vec3d = new Vec3d(nbttaglist5.getDoubleAt(0), nbttaglist5.getDoubleAt(1), nbttaglist5.getDoubleAt(2));
        NBTTagList nbttaglist6 = nbttagcompound3.getTagList("blockPos", 3);
        BlockPos blockpos1 = new BlockPos(nbttaglist6.getIntAt(0), nbttaglist6.getIntAt(1), nbttaglist6.getIntAt(2));

        if (nbttagcompound3.hasKey("nbt"))
        {
            NBTTagCompound nbttagcompound2 = nbttagcompound3.getCompoundTag("nbt");
            this.entities.add(new Template.EntityInfo(vec3d, blockpos1, nbttagcompound2));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:55,代碼來源:Template.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)
{
    this.xTile = compound.getInteger("xTile");
    this.yTile = compound.getInteger("yTile");
    this.zTile = compound.getInteger("zTile");

    if (compound.hasKey("inTile", 8))
    {
        this.inTile = Block.getBlockFromName(compound.getString("inTile"));
    }
    else
    {
        this.inTile = Block.getBlockById(compound.getByte("inTile") & 255);
    }

    this.inGround = compound.getByte("inGround") == 1;

    if (compound.hasKey("power", 9))
    {
        NBTTagList nbttaglist = compound.getTagList("power", 6);

        if (nbttaglist.tagCount() == 3)
        {
            this.accelerationX = nbttaglist.getDoubleAt(0);
            this.accelerationY = nbttaglist.getDoubleAt(1);
            this.accelerationZ = nbttaglist.getDoubleAt(2);
        }
    }

    this.ticksAlive = compound.getInteger("life");

    if (compound.hasKey("direction", 9) && compound.getTagList("direction", 6).tagCount() == 3)
    {
        NBTTagList nbttaglist1 = compound.getTagList("direction", 6);
        this.motionX = nbttaglist1.getDoubleAt(0);
        this.motionY = nbttaglist1.getDoubleAt(1);
        this.motionZ = nbttaglist1.getDoubleAt(2);
    }
    else
    {
        this.setDead();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:47,代碼來源:EntityFireball.java


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