当前位置: 首页>>代码示例>>Java>>正文


Java NBTTagCompound.getDouble方法代码示例

本文整理汇总了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;
        }
    }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:SharedMonsterAttributes.java

示例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;
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:18,代码来源:ItemCompositionPaper.java

示例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;
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:18,代码来源:ItemCompositionPaper.java

示例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>();
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:27,代码来源:ItemCompositionPaper.java

示例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");
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:EntityMinecartFurnace.java

示例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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:EntityArrow.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:EntityArrow.java

示例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"));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:EntityShulkerBullet.java

示例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");
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:TileEntityLiquidCompressor.java

示例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");
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:EntityMinecartFurnace.java

示例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");
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:14,代码来源:BasicSource.java

示例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;
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:15,代码来源:SlimeBlock.java

示例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");
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:10,代码来源:EntityMagicCircles.java

示例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;
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:16,代码来源:ItemCompositionPaper.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:SharedMonsterAttributes.java


注:本文中的net.minecraft.nbt.NBTTagCompound.getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。