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


Java NBTTagCompound.setFloat方法代码示例

本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.setFloat方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.setFloat方法的具体用法?Java NBTTagCompound.setFloat怎么用?Java NBTTagCompound.setFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.nbt.NBTTagCompound的用法示例。

在下文中一共展示了NBTTagCompound.setFloat方法的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setString("name", this.name);
    compound.setString("author", this.author);
    compound.setString("metadata", this.metadata);
    compound.setInteger("posX", this.position.getX());
    compound.setInteger("posY", this.position.getY());
    compound.setInteger("posZ", this.position.getZ());
    compound.setInteger("sizeX", this.size.getX());
    compound.setInteger("sizeY", this.size.getY());
    compound.setInteger("sizeZ", this.size.getZ());
    compound.setString("rotation", this.rotation.toString());
    compound.setString("mirror", this.mirror.toString());
    compound.setString("mode", this.mode.toString());
    compound.setBoolean("ignoreEntities", this.ignoreEntities);
    compound.setBoolean("powered", this.powered);
    compound.setBoolean("showair", this.showAir);
    compound.setBoolean("showboundingbox", this.showBoundingBox);
    compound.setFloat("integrity", this.integrity);
    compound.setLong("seed", this.seed);
    return compound;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:TileEntityStructure.java


示例2: getChargedDispenserUpgradeDrone

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
private static EntityDrone getChargedDispenserUpgradeDrone(World world) {
    EntityDrone drone = new EntityDrone(world);

    NBTTagCompound tag = new NBTTagCompound();
    drone.writeEntityToNBT(tag);

    ItemStackHandler upgrades = new ItemStackHandler(9);
    upgrades.setStackInSlot(0, new ItemStack(ItemRegistry.getInstance().getUpgrade(EnumUpgrade.DISPENSER), 64));
    upgrades.setStackInSlot(1, new ItemStack(ItemRegistry.getInstance().getUpgrade(EnumUpgrade.SPEED), 10));
    tag.setTag(ChargeableItemHandler.NBT_UPGRADE_TAG, upgrades.serializeNBT());
    tag.setTag("Inventory", new NBTTagCompound());
    tag.setFloat("currentAir", 100000);

    drone.readEntityFromNBT(tag);
    // FIXME: we really need to get a clientside localization here (on the server side)
    drone.setCustomNameTag(net.minecraft.util.text.translation.I18n.translateToLocal("drone.amadronDeliveryDrone"));

    drone.naturallySpawned = true; // Don't let the drone be dropped when wrenching it.

    return drone;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:ProgrammedDroneUtils.java


示例3: serializePartialNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound serializePartialNBT()
{
    NBTTagCompound ret = new NBTTagCompound();
    if (this.dormantOre_IsDirty)
    {
        ret.setByte("oreID", (byte) this.dormantOre.ordinal());
        this.dormantOre_IsDirty = false;
    }

    if (this.dormantOreAmount_IsDirty)
    {
        ret.setFloat("oreAmount", this.dormantOreAmount);
        this.dormantOreAmount_IsDirty = false;
    }

    if (this.temperatureData_IsDirty)
    {
        NBTTagList list = new NBTTagList();
        this.temperatureData.forEach((BlockPos pos, Float f) -> list.appendTag(NBTChain.startChain().withLong("key", pos.toLong()).withFloat("value", f).endChain()));
        ret.setTag("temperatureData", list);
        this.temperatureData_IsDirty = false;
    }

    this.isDirty = false;
    return ret;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:27,代码来源:ExPChunk.java


示例4: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public NBTTagCompound writeToNBT() {
	NBTTagCompound tag = new NBTTagCompound();
	
	tag.setFloat("Base", this.baseStability);
	tag.setFloat("Stability", this.stability);
	
	return tag;
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:9,代码来源:StabilityData.java


示例5: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    if (this.getDisplayedItem() != null)
    {
        compound.setTag("Item", this.getDisplayedItem().writeToNBT(new NBTTagCompound()));
        compound.setByte("ItemRotation", (byte)this.getRotation());
        compound.setFloat("ItemDropChance", this.itemDropChance);
    }

    super.writeEntityToNBT(compound);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:EntityItemFrame.java


示例6: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    super.writeEntityToNBT(tagCompound);
    tagCompound.setTag("Inventory", this.inventory.writeToNBT(new NBTTagList()));
    tagCompound.setInteger("SelectedItemSlot", this.inventory.currentItem);
    tagCompound.setBoolean("Sleeping", this.sleeping);
    tagCompound.setShort("SleepTimer", (short)this.sleepTimer);
    tagCompound.setFloat("XpP", this.experience);
    tagCompound.setInteger("XpLevel", this.experienceLevel);
    tagCompound.setInteger("XpTotal", this.experienceTotal);
    tagCompound.setInteger("XpSeed", this.xpSeed);
    tagCompound.setInteger("Score", this.getScore());

    if (this.spawnChunk != null)
    {
        tagCompound.setInteger("SpawnX", this.spawnChunk.getX());
        tagCompound.setInteger("SpawnY", this.spawnChunk.getY());
        tagCompound.setInteger("SpawnZ", this.spawnChunk.getZ());
        tagCompound.setBoolean("SpawnForced", this.spawnForced);
    }

    this.foodStats.writeNBT(tagCompound);
    this.capabilities.writeCapabilitiesToNBT(tagCompound);
    tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT());
    ItemStack itemstack = this.inventory.getCurrentItem();

    if (itemstack != null && itemstack.getItem() != null)
    {
        tagCompound.setTag("SelectedItem", itemstack.writeToNBT(new NBTTagCompound()));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:35,代码来源:EntityPlayer.java


示例7: serializeNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound serializeNBT() {
	NBTTagCompound compound = new NBTTagCompound();
	NBTTagList items = new NBTTagList();

	for (int i = 0; i < getSizeInventory(); ++i) {
		if (!getStackInSlot(i).isEmpty()) {
			NBTTagCompound item = new NBTTagCompound();
			item.setInteger("Slot", i);
			getStackInSlot(i).writeToNBT(item);

			items.appendTag(item);
		}
	}
	compound.setTag("ItemInventory", items);

	NBTTagList pricesList = new NBTTagList();

	if (prices != null && !prices.isEmpty()) {
		for (int i = 0; i < getSizeInventory(); ++i) {
			if (prices.get(i) != null) {
				NBTTagCompound price = new NBTTagCompound();
				price.setInteger("Slot", i);
				price.setFloat("price", prices.get(i));

				pricesList.appendTag(price);
			}
		}
	}
	compound.setTag("Prices", pricesList);

	return compound;
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:34,代码来源:CartCapability.java


示例8: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
    super.writeToNBT(tag);
    tag.setFloat("clawProgress", clawProgress);
    tag.setBoolean("clawClosing", shouldClawClose);
    tag.setByte("state", state);
    tag.setBoolean("exporting", exporting);
    tag.setTag("Items", inventory.serializeNBT());
    return tag;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:11,代码来源:TileEntityAssemblyIOUnit.java


示例9: writeNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTBase writeNBT(Capability<IRotaryPowerSupply> capability, IRotaryPowerSupply instance, EnumFacing side) {
	NBTTagCompound tag = new NBTTagCompound();
	tag.setFloat("buffer", instance.getBufferedPower());
	tag.setFloat("torque", instance.getTorqueSetting());
	return tag;
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:8,代码来源:DefaultRotaryPowerSerializer.java


示例10: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setInteger("blockId", Block.getIdFromBlock(this.pistonState.getBlock()));
    compound.setInteger("blockData", this.pistonState.getBlock().getMetaFromState(this.pistonState));
    compound.setInteger("facing", this.pistonFacing.getIndex());
    compound.setFloat("progress", this.lastProgress);
    compound.setBoolean("extending", this.extending);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:TileEntityPiston.java


示例11: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
    super.writeToNBT(tag);
    tag.setFloat("targetRotationAngle", targetRotationAngle);
    tag.setFloat("targetHeightAngle", targetHeightAngle);
    tag.setFloat("rotationAngle", rotationAngle);
    tag.setFloat("heightAngle", heightAngle);
    tag.setInteger("gpsX", gpsX);
    tag.setInteger("gpsY", gpsY);
    tag.setInteger("gpsZ", gpsZ);
    tag.setByte("redstoneMode", (byte) redstoneMode);
    tag.setBoolean("targetWithinReach", coordWithinReach);
    tag.setTag("Items", inventory.serializeNBT());

    NBTTagList tagList = new NBTTagList();
    for (EntityItem entity : trackedItems) {
        UUID uuid = entity.getUniqueID();
        NBTTagCompound t = new NBTTagCompound();
        t.setLong("UUIDMost", uuid.getMostSignificantBits());
        t.setLong("UUIDLeast", uuid.getLeastSignificantBits());
        tagList.appendTag(t);
    }
    tag.setTag("trackedItems", tagList);

    if (lastInsertingInventory != null) {
        tag.setInteger("inventoryX", lastInsertingInventory.getX());
        tag.setInteger("inventoryY", lastInsertingInventory.getY());
        tag.setInteger("inventoryZ", lastInsertingInventory.getZ());
        tag.setByte("inventorySide", (byte) lastInsertingInventorySide.ordinal());
    }

    return tag;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:34,代码来源:TileEntityAirCannon.java


示例12: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
    super.writeToNBT(tag);
    tag.setFloat("extension", extension);
    tag.setFloat("targetExtension", targetExtension);
    tag.setInteger("redstoneMode", redstoneMode);
    tag.setInteger("maxFloorHeight", maxFloorHeight);
    for (int i = 0; i < 6; i++) {
        tag.setBoolean("sideConnected" + i, sidesConnected[i]);
    }
    ICamouflageableTE.writeCamoStackToNBT(camoStack, tag);
    return tag;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:TileEntityElevatorBase.java


示例13: writeCapabilitiesToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void writeCapabilitiesToNBT(NBTTagCompound tagCompound)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.setBoolean("invulnerable", this.disableDamage);
    nbttagcompound.setBoolean("flying", this.isFlying);
    nbttagcompound.setBoolean("mayfly", this.allowFlying);
    nbttagcompound.setBoolean("instabuild", this.isCreativeMode);
    nbttagcompound.setBoolean("mayBuild", this.allowEdit);
    nbttagcompound.setFloat("flySpeed", this.flySpeed);
    nbttagcompound.setFloat("walkSpeed", this.walkSpeed);
    tagCompound.setTag("abilities", nbttagcompound);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:PlayerCapabilities.java


示例14: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void writeToNBT(NBTTagCompound tag) {
	NBTTagCompound sucTag = new NBTTagCompound();
	
	sucTag.setInteger("strength", this.strength);
	sucTag.setFloat("minPurity", this.minPurity);
	sucTag.setFloat("maxPurity", this.maxPurity);
	
	tag.setTag("Suction", sucTag);
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:10,代码来源:Suction.java


示例15: serializeNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound serializeNBT() {
	NBTTagCompound properties = new NBTTagCompound();
	properties.setFloat("amount", amount);
	return properties;
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:7,代码来源:AccountCapability.java


示例16: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void writeToNBT(NBTTagCompound tag) {
    super.writeToNBT(tag);
    tag.setFloat("rotation", rotation);
    tag.setInteger("flow", oldFlow);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:7,代码来源:ModuleFlowDetector.java


示例17: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
    super.writeToNBT(nbt);
    nbt.setFloat("setpoint", pressureSetpoint);
    return nbt;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:7,代码来源:TileEntityCreativeCompressor.java


示例18: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
 * Save the entity to NBT (calls an abstract helper method to write extra data)
 */
public void writeToNBT(NBTTagCompound tagCompund)
{
    try
    {
        tagCompund.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY, this.posZ}));
        tagCompund.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
        tagCompund.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        tagCompund.setFloat("FallDistance", this.fallDistance);
        tagCompund.setShort("Fire", (short)this.fire);
        tagCompund.setShort("Air", (short)this.getAir());
        tagCompund.setBoolean("OnGround", this.onGround);
        tagCompund.setInteger("Dimension", this.dimension);
        tagCompund.setBoolean("Invulnerable", this.invulnerable);
        tagCompund.setInteger("PortalCooldown", this.timeUntilPortal);
        tagCompund.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
        tagCompund.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());

        if (this.getCustomNameTag() != null && this.getCustomNameTag().length() > 0)
        {
            tagCompund.setString("CustomName", this.getCustomNameTag());
            tagCompund.setBoolean("CustomNameVisible", this.getAlwaysRenderNameTag());
        }

        this.cmdResultStats.writeStatsToNBT(tagCompund);

        if (this.isSilent())
        {
            tagCompund.setBoolean("Silent", this.isSilent());
        }

        this.writeEntityToNBT(tagCompund);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound = new NBTTagCompound();

            if (this.ridingEntity.writeMountToNBT(nbttagcompound))
            {
                tagCompund.setTag("Riding", nbttagcompound);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:54,代码来源:Entity.java


示例19: useCauldron

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
public boolean useCauldron(EntityPlayer player, EnumHand hand, ItemStack heldItem) {
	if (!world.isRemote) {
		if (heldItem.isEmpty()) {
			if (!getContainer().isEmpty()) {
				giveItem(player, hand, ItemStack.EMPTY, getContainer());
				setContainer(ItemStack.EMPTY);
			} else if (inv.isFull() && hasIngredients() && mode != Mode.RITUAL) {
				itemRitualLogic();
			}
			return true;
		}
		//Held Item is not empty
		if (heldItem.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.UP)) {
			handleLiquid(heldItem.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.UP));
		} else if (heldItem.getItem() == Items.POTIONITEM && PotionUtils.getEffectsFromStack(heldItem).isEmpty()) {
			int level = inv.getFluidAmount();
			if (level < BUCKET_VOLUME && (inv.getFluid() == null || inv.hasFluid(FluidRegistry.WATER))) {
				play(SoundEvents.ITEM_BUCKET_FILL, 1F, 1F);
				giveItem(player, hand, heldItem, new ItemStack(Items.GLASS_BOTTLE));
				FluidStack fluidStack = new FluidStack(FluidRegistry.WATER, 250);
				inv.fill(fluidStack, true);
			}
		} else if (heldItem.getItem() == Items.GLASS_BOTTLE) {
			if (mode == Mode.POTION) {
				potionRecipeLogic(player, hand, heldItem);
			} else if (mode == Mode.CUSTOM) {
				potionCustomLogic(player, hand, heldItem);
			}
		} else if (heldItem.getItem() == Items.BOWL) {
			ItemStack stewToGive = new ItemStack(ModItems.stew);
			int hunger = 0;
			float saturation = 0f;
			float multiplier = 1.0f;
			for (ItemStack stack : ingredients) {
				if (CauldronRegistry.getFoodValues().get(stack.getItem()) != null) {
					CauldronFoodValue foodValue = CauldronRegistry.getFoodValues().get(stack.getItem());
					hunger += foodValue.hunger * multiplier;
					saturation += foodValue.saturation * multiplier;
					multiplier *= 0.75;
				}
			}
			NBTTagCompound nbt = new NBTTagCompound();
			stewToGive.setTagCompound(nbt);
			nbt.setInteger("hunger", hunger);
			nbt.setFloat("saturation", saturation);

			if (player.addItemStackToInventory(stewToGive)) { //if the player has enough inventory space
				heldItem.setCount(heldItem.getCount() - 1);
				ingredients.clear();
				inv.setFluid(null);
				setContainer(ItemStack.EMPTY);
			}
		} else if (getContainer().isEmpty()) {
			ItemStack copy = heldItem.copy();
			setContainer(copy);
			player.setHeldItem(hand, ItemStack.EMPTY);
		}
	}
	return true;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:62,代码来源:TileCauldron.java



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