本文整理匯總了Java中net.minecraft.nbt.NBTTagCompound.getDouble方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTTagCompound.getDouble方法的具體用法?Java NBTTagCompound.getDouble怎麽用?Java NBTTagCompound.getDouble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.getDouble方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readAttributeModifierFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Nullable
/**
* Creates an AttributeModifier from an NBTTagCompound
*/
public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound compound)
{
UUID uuid = compound.getUniqueId("UUID");
try
{
return new AttributeModifier(uuid, compound.getString("Name"), compound.getDouble("Amount"), compound.getInteger("Operation"));
}
catch (Exception exception)
{
LOGGER.warn("Unable to create attribute: {}", new Object[] {exception.getMessage()});
return null;
}
}
示例2: getSong
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static ISong getSong(ItemStack stack){
if (stack.hasTagCompound()){
if (stack.getTagCompound().hasKey(SOUNDS_TAG)){
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(SOUNDS_TAG);
for (SoundType s : SoundType.getSoundTypes()){
if (tag.hasKey(s.getTag())){
if (tag.getDouble(s.getTag()) >= 100.0){
if (tag.hasKey("songIndex")){
return SongRegistry.getSongs(s).get(tag.getInteger("songIndex"));
}
}
}
}
}
}
return null;
}
示例3: getHighestSoundType
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static SoundType getHighestSoundType(ItemStack stack){
double max = 0;
SoundType type = null;
NBTTagCompound itemTag = ItemUtil.getOrCreateTag(stack);
if (itemTag.hasKey(SOUNDS_TAG)) {
NBTTagCompound container = stack.getTagCompound().getCompoundTag(SOUNDS_TAG);
for (SoundType t : SoundType.getSoundTypes()){
if (container.hasKey(t.getTag())){
if (container.getDouble(t.getTag()) > max){
max = container.getDouble(t.getTag());
type = t;
}
}
}
}
return type;
}
示例4: getHeldSounds
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static Map<SoundType, Double> getHeldSounds(ItemStack paper) {
if (paper.getItem() instanceof ItemCompositionPaper) {
if (paper.hasTagCompound()) {
NBTTagCompound itemTag = paper.getTagCompound();
if (itemTag.hasKey(SOUNDS_TAG)) {
Map<SoundType, Double> toRet = new HashMap<SoundType, Double>();
NBTTagCompound container = itemTag.getCompoundTag(SOUNDS_TAG);
for (SoundType type : SoundType.getSoundTypes()) {
double amount = 0;
if (container.hasKey(type.getTag())) {
amount = container.getDouble(type.getTag());
}
toRet.put(type, amount);
}
return toRet;
}
}
}
return new HashMap<SoundType, Double>();
}
示例5: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
this.pushX = compound.getDouble("PushX");
this.pushZ = compound.getDouble("PushZ");
this.fuel = compound.getShort("Fuel");
}
示例6: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的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");
this.ticksInGround = tagCompund.getShort("life");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.inData = tagCompund.getByte("inData") & 255;
this.arrowShake = tagCompund.getByte("shake") & 255;
this.inGround = tagCompund.getByte("inGround") == 1;
if (tagCompund.hasKey("damage", 99))
{
this.damage = tagCompund.getDouble("damage");
}
if (tagCompund.hasKey("pickup", 99))
{
this.canBePickedUp = tagCompund.getByte("pickup");
}
else if (tagCompund.hasKey("player", 99))
{
this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0;
}
}
示例7: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的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");
this.ticksInGround = compound.getShort("life");
if (compound.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(compound.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(compound.getByte("inTile") & 255);
}
this.inData = compound.getByte("inData") & 255;
this.arrowShake = compound.getByte("shake") & 255;
this.inGround = compound.getByte("inGround") == 1;
if (compound.hasKey("damage", 99))
{
this.damage = compound.getDouble("damage");
}
if (compound.hasKey("pickup", 99))
{
this.pickupStatus = EntityArrow.PickupStatus.getByOrdinal(compound.getByte("pickup"));
}
else if (compound.hasKey("player", 99))
{
this.pickupStatus = compound.getBoolean("player") ? EntityArrow.PickupStatus.ALLOWED : EntityArrow.PickupStatus.DISALLOWED;
}
}
示例8: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
this.steps = compound.getInteger("Steps");
this.targetDeltaX = compound.getDouble("TXD");
this.targetDeltaY = compound.getDouble("TYD");
this.targetDeltaZ = compound.getDouble("TZD");
if (compound.hasKey("Dir", 99))
{
this.direction = EnumFacing.getFront(compound.getInteger("Dir"));
}
if (compound.hasKey("Owner", 10))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("Owner");
this.ownerUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound);
this.ownerBlockPos = new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z"));
}
if (compound.hasKey("Target", 10))
{
NBTTagCompound nbttagcompound1 = compound.getCompoundTag("Target");
this.targetUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound1);
this.targetBlockPos = new BlockPos(nbttagcompound1.getInteger("X"), nbttagcompound1.getInteger("Y"), nbttagcompound1.getInteger("Z"));
}
}
示例9: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
inventory.deserializeNBT(tag.getCompoundTag("Items"));
redstoneMode = tag.getByte("redstoneMode");
tank.readFromNBT(tag.getCompoundTag("tank"));
internalFuelBuffer = tag.getDouble("internalFuelBuffer");
}
示例10: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
super.readEntityFromNBT(tagCompund);
this.pushX = tagCompund.getDouble("PushX");
this.pushZ = tagCompund.getDouble("PushZ");
this.fuel = tagCompund.getShort("Fuel");
}
示例11: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* Forward for the base TileEntity's readFromNBT(), used for loading the state.
*
* @param tag Compound tag as supplied by TileEntity.readFromNBT()
*/
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
NBTTagCompound data = tag.getCompoundTag("IC2BasicSource");
energyStored = data.getDouble("energy");
}
示例12: onEntityCollidedWithBlock
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
NBTTagCompound data = entity.getEntityData();
if (data.hasKey(Reference.MOD_ID + ":slime")) {
entity.motionY = data.getDouble(Reference.MOD_ID + ":slime");
data.removeTag(Reference.MOD_ID + ":slime");
}
if (Math.abs(entity.motionY) < 0.1 && !entity.isSneaking()) {
double d = 0.4 + Math.abs(entity.motionY) * 0.2;
entity.motionX *= d;
entity.motionZ *= d;
}
}
示例13: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readEntityFromNBT(NBTTagCompound compound)
{
constantRot = compound.getDouble("constantRot");
edgeRot = compound.getDouble("edgeRot");
circlePos = new Vec3d(compound.getDouble("circleX"), compound.getDouble("circleY"),
compound.getDouble("circleX"));
hasBook = compound.getBoolean("hasBook");
}
示例14: isComplete
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static boolean isComplete(ItemStack stack){
if (stack.hasTagCompound()){
if (stack.getTagCompound().hasKey(SOUNDS_TAG)){
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(SOUNDS_TAG);
for (SoundType s : SoundType.getSoundTypes()){
if (tag.hasKey(s.getTag())){
if (tag.getDouble(s.getTag()) >= 100.0){
return true;
}
}
}
}
}
return false;
}
示例15: readAttributeModifierFromNBT
import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
* Creates an AttributeModifier from an NBTTagCompound
*/
public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound p_111259_0_)
{
UUID uuid = new UUID(p_111259_0_.getLong("UUIDMost"), p_111259_0_.getLong("UUIDLeast"));
try
{
return new AttributeModifier(uuid, p_111259_0_.getString("Name"), p_111259_0_.getDouble("Amount"), p_111259_0_.getInteger("Operation"));
}
catch (Exception exception)
{
logger.warn("Unable to create attribute: " + exception.getMessage());
return null;
}
}