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


Java NBTTagCompound.setDouble方法代碼示例

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


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

示例1: writeAttributeInstanceToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Creates an NBTTagCompound from an AttributeInstance, including its AttributeModifiers
 */
private static NBTTagCompound writeAttributeInstanceToNBT(IAttributeInstance instance)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    IAttribute iattribute = instance.getAttribute();
    nbttagcompound.setString("Name", iattribute.getAttributeUnlocalizedName());
    nbttagcompound.setDouble("Base", instance.getBaseValue());
    Collection<AttributeModifier> collection = instance.getModifiers();

    if (collection != null && !collection.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (AttributeModifier attributemodifier : collection)
        {
            if (attributemodifier.isSaved())
            {
                nbttaglist.appendTag(writeAttributeModifierToNBT(attributemodifier));
            }
        }

        nbttagcompound.setTag("Modifiers", nbttaglist);
    }

    return nbttagcompound;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:29,代碼來源:SharedMonsterAttributes.java

示例2: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Forward for the base TileEntity's writeToNBT(), used for saving the state.
 *
 * @param tag Compound tag as supplied by TileEntity.writeToNBT()
 */
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
	try {
		super.writeToNBT(tag);
	} catch (RuntimeException e) {
		// happens if this is a delegate, ignore
	}

	NBTTagCompound data = new NBTTagCompound();

	data.setDouble("energy", energyStored);

	tag.setTag("IC2BasicSink", data);

	return tag;
}
 
開發者ID:Herobone,項目名稱:HeroUtils,代碼行數:22,代碼來源:BasicSink.java

示例3: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Forward for the base TileEntity's writeToNBT(), used for saving the state.
 *
 * @param tag Compound tag as supplied by TileEntity.writeToNBT()
 */
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
	try {
		super.writeToNBT(tag);
	} catch (RuntimeException e) {
		// happens if this is a delegate, ignore
	}

	NBTTagCompound data = new NBTTagCompound();

	data.setDouble("energy", energyStored);

	tag.setTag("IC2BasicSource", data);

	return tag;
}
 
開發者ID:Herobone,項目名稱:HeroUtils,代碼行數:22,代碼來源:BasicSource.java

示例4: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
protected void writeEntityToNBT(NBTTagCompound tag) 
{
	tag.setShort("xTile", (short)this.stuckBlockX);
       tag.setShort("yTile", (short)this.stuckBlockY);
       tag.setShort("zTile", (short)this.stuckBlockY);
       
       tag.setShort("life", (short) this.ticksInGround);
       tag.setShort("lifeMax", (short) this.ticksInGroundMax);
       tag.setShort("lifeInAirMax", (short) this.ticksInAirMax);
       
       tag.setByte("inTile", (byte)Block.getIdFromBlock(this.stuckBlock));
       
       tag.setByte("inData", (byte)this.inData);
       
       tag.setByte("shake", (byte)this.arrowShake);
       
       tag.setByte("inGround", (byte)(this.inGround ? 1 : 0));
       
       tag.setBoolean("pickup", (boolean)this.canBePickedUp);
       
       tag.setDouble("damage", this.damage);
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:24,代碼來源:_ProjectileBase.java

示例5: writeAttributeModifierToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Helper method for writing new attribute modifiers.
 * @param attribute
 * @param modifier
 * @param slot
 * @return
 */
public static NBTTagCompound writeAttributeModifierToNBT(IAttribute attribute, AttributeModifier modifier, EntityEquipmentSlot slot) 
{
	NBTTagCompound nbt = new NBTTagCompound();
	
	nbt.setString("AttributeName", attribute.getName());
	nbt.setString("Name", modifier.getName());
	nbt.setString("Slot", slot.getName());
	nbt.setDouble("Amount", modifier.getAmount());
	nbt.setInteger("Operation", modifier.getOperation());
	nbt.setLong("UUIDMost", modifier.getID().getMostSignificantBits());
	nbt.setLong("UUIDLeast", modifier.getID().getLeastSignificantBits());
	
	return nbt;
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:22,代碼來源:ItemGeneratorHelper.java

示例6: createMagical

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/** Creates a magical weapon with randomized stats. */
public static void createMagical(ItemStack stack, NBTTagCompound nbt, World world, ChunkPos pos)
{
	if (Rarity.getRarity(nbt) != Rarity.DEFAULT && stack.getItem() instanceof ItemLEMagical)
	{
		IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
		IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(pos);
		int level = chunkLevel.getChunkLevel();
		ItemLEMagical wand = (ItemLEMagical) stack.getItem();
		
		ItemGeneratorHelper.setTypes(stack, nbt);
		Rarity.setRarity(nbt, Rarity.getRandomRarity(nbt, ItemGeneratorHelper.rand));
		nbt.setInteger("Level", level);
		ItemGeneratorHelper.setRandomAttributes(stack, nbt, Rarity.getRarity(nbt));
		
		// handles setting weighted damage/attack speed and min/max damage
		double baseDamage = wand.getBaseDamage();
		double baseAttackSpeed = wand.getBaseAttackSpeed();
		double weightedDamage = ItemGeneratorHelper.getWeightedDamage(nbt, Rarity.getRarity(nbt), baseDamage);
		double weightedAttackSpeed = ItemGeneratorHelper.getWeightedAttackSpeed(Rarity.getRarity(nbt), baseAttackSpeed);
		
		ItemGeneratorHelper.setMinMaxDamage(nbt, weightedDamage);
		nbt.setDouble("AttackSpeed", weightedAttackSpeed);
		ItemGeneratorHelper.setRune(nbt);
		nbt.setInteger("HideFlags", 6); // hides Attribute Modifier and Unbreakable tags
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:28,代碼來源:ItemGenerator.java

示例7: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound compound)
{
    if (this.owner != null)
    {
        BlockPos blockpos = new BlockPos(this.owner);
        NBTTagCompound nbttagcompound = NBTUtil.createUUIDTag(this.owner.getUniqueID());
        nbttagcompound.setInteger("X", blockpos.getX());
        nbttagcompound.setInteger("Y", blockpos.getY());
        nbttagcompound.setInteger("Z", blockpos.getZ());
        compound.setTag("Owner", nbttagcompound);
    }

    if (this.target != null)
    {
        BlockPos blockpos1 = new BlockPos(this.target);
        NBTTagCompound nbttagcompound1 = NBTUtil.createUUIDTag(this.target.getUniqueID());
        nbttagcompound1.setInteger("X", blockpos1.getX());
        nbttagcompound1.setInteger("Y", blockpos1.getY());
        nbttagcompound1.setInteger("Z", blockpos1.getZ());
        compound.setTag("Target", nbttagcompound1);
    }

    if (this.direction != null)
    {
        compound.setInteger("Dir", this.direction.getIndex());
    }

    compound.setInteger("Steps", this.steps);
    compound.setDouble("TXD", this.targetDeltaX);
    compound.setDouble("TYD", this.targetDeltaY);
    compound.setDouble("TZD", this.targetDeltaZ);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:36,代碼來源:EntityShulkerBullet.java

示例8: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
	tag.setDouble("x", x);
	tag.setDouble("y", y);
	tag.setDouble("z", z);

	return tag;
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:8,代碼來源:Vector3.java

示例9: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeEntityToNBT(NBTTagCompound compound)
{
	compound.setDouble("constantRot", constantRot);
	compound.setDouble("edgeRot", edgeRot);
	compound.setDouble("circleX", circlePos.x);
	compound.setDouble("circleY", circlePos.y);
	compound.setDouble("circleZ", circlePos.z);
	compound.setBoolean("hasBook", this.hasBook);
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:11,代碼來源:EntityMagicCircles.java

示例10: writeAttributeModifierToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Creates an NBTTagCompound from an AttributeModifier
 */
private static NBTTagCompound writeAttributeModifierToNBT(AttributeModifier p_111262_0_)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.setString("Name", p_111262_0_.getName());
    nbttagcompound.setDouble("Amount", p_111262_0_.getAmount());
    nbttagcompound.setInteger("Operation", p_111262_0_.getOperation());
    nbttagcompound.setLong("UUIDMost", p_111262_0_.getID().getMostSignificantBits());
    nbttagcompound.setLong("UUIDLeast", p_111262_0_.getID().getLeastSignificantBits());
    return nbttagcompound;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:14,代碼來源:SharedMonsterAttributes.java

示例11: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound tag) {
    tag.setDouble("posX", posX);
    tag.setDouble("posY", posY);
    tag.setDouble("width", width);
    tag.setDouble("height", height);
    tag.setString("buttonText", buttonText);
    tag.setInteger("floorNumber", floorNumber);
    tag.setInteger("floorHeight", floorHeight);
    tag.setFloat("red", red);
    tag.setFloat("green", green);
    tag.setFloat("blue", blue);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:13,代碼來源:TileEntityElevatorCaller.java

示例12: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setShort("xTile", (short)this.xTile);
    tagCompound.setShort("yTile", (short)this.yTile);
    tagCompound.setShort("zTile", (short)this.zTile);
    tagCompound.setShort("life", (short)this.ticksInGround);
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
    tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("inData", (byte)this.inData);
    tagCompound.setByte("shake", (byte)this.arrowShake);
    tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
    tagCompound.setByte("pickup", (byte)this.canBePickedUp);
    tagCompound.setDouble("damage", this.damage);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:EntityArrow.java

示例13: writeAttributeModifierToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Creates an NBTTagCompound from an AttributeModifier
 */
public static NBTTagCompound writeAttributeModifierToNBT(AttributeModifier modifier)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.setString("Name", modifier.getName());
    nbttagcompound.setDouble("Amount", modifier.getAmount());
    nbttagcompound.setInteger("Operation", modifier.getOperation());
    nbttagcompound.setUniqueId("UUID", modifier.getID());
    return nbttagcompound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:SharedMonsterAttributes.java

示例14: writeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Nullable
@Override
public NBTBase writeNBT(Capability<IFaerieInformation> capability, IFaerieInformation instance, EnumFacing side) {
    NBTTagCompound comp = new NBTTagCompound();
    comp.setInteger("type", instance.getType());
    comp.setFloat("size", instance.getSize());
    comp.setDouble("max_health", instance.getMaxHealth());
    comp.setInteger("level", instance.getLevel());
    comp.setInteger("current_exp", instance.getCurrentExp());

    return comp;
}
 
開發者ID:BenjaminSutter,項目名稱:genera,代碼行數:13,代碼來源:FaerieInformationStorage.java

示例15: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound tagCompound)
{
    super.writeEntityToNBT(tagCompound);
    tagCompound.setDouble("PushX", this.pushX);
    tagCompound.setDouble("PushZ", this.pushZ);
    tagCompound.setShort("Fuel", (short)this.fuel);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:11,代碼來源:EntityMinecartFurnace.java


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