本文整理匯總了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;
}
示例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"));
}
示例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);
}
}
示例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);
}
示例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"));
}
示例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"));
}