Java Code Examples for net.minecraft.nbt.NBTTagCompound#setDouble()
The following examples show how to use
net.minecraft.nbt.NBTTagCompound#setDouble() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LPRoutedItem.java From Logistics-Pipes-2 with MIT License | 6 votes |
public NBTTagCompound writeToNBT() { NBTTagCompound tag = new NBTTagCompound(); Triple<Double, Double, Double> pos = getPosition(); tag.setDouble("posX", pos.getFirst()); tag.setDouble("posY", pos.getSecnd()); tag.setDouble("posZ", pos.getThird()); tag.setInteger("heading", heading.ordinal()); tag.setUniqueId("UID", this.ID); tag.setTag("inventory", stack.serializeNBT()); tag.setInteger("ticks", this.ticks); NBTTagList routeList = new NBTTagList(); for(EnumFacing node : route) { NBTTagCompound nodeTag = new NBTTagCompound(); //nodeTag.setUniqueId("UID", node.getKey()); nodeTag.setInteger("heading", node.ordinal()); routeList.appendTag(nodeTag); } tag.setTag("route", routeList); return tag; }
Example 2
Source File: RiverAttribute.java From TFC2 with GNU General Public License v3.0 | 6 votes |
@Override public void writeToNBT(NBTTagCompound nbt) { nbt.setString("uuid", id.toString()); nbt.setDouble("river", river); if(downriver != null) nbt.setInteger("downriver", downriver.index); if(upriver != null && upriver.size() > 0) { int[] nArray = new int[upriver.size()]; for(int i = 0; i < nArray.length; i++) { nArray[i] = upriver.get(i).index; } nbt.setIntArray("upriver", nArray); } nbt.setDouble("midX", riverMid.x); nbt.setDouble("midY", riverMid.y); nbt.setBoolean("isDead", deadRiver); }
Example 3
Source File: LPRoutedFluid.java From Logistics-Pipes-2 with MIT License | 6 votes |
public NBTTagCompound writeToNBT() { NBTTagCompound tag = new NBTTagCompound(); Triple<Double, Double, Double> pos = getPosition(); tag.setDouble("posX", pos.getFirst()); tag.setDouble("posY", pos.getSecnd()); tag.setDouble("posZ", pos.getThird()); tag.setInteger("heading", heading.ordinal()); tag.setUniqueId("UID", this.ID); tag.setTag("inventory", stack.writeToNBT(new NBTTagCompound())); tag.setInteger("ticks", this.ticks); NBTTagList routeList = new NBTTagList(); for(EnumFacing node : route) { NBTTagCompound nodeTag = new NBTTagCompound(); //nodeTag.setUniqueId("UID", node.getKey()); nodeTag.setInteger("heading", node.ordinal()); routeList.appendTag(nodeTag); } tag.setTag("route", routeList); return tag; }
Example 4
Source File: SpaceObjectBase.java From AdvancedRocketry with MIT License | 6 votes |
@Override public void writeToNbt(NBTTagCompound nbt) { properties.writeToNBT(nbt); nbt.setInteger("id", getId()); nbt.setInteger("posX", posX); nbt.setInteger("posY", posY); nbt.setInteger("alitude", altitude); nbt.setInteger("spawnX", spawnLocation.x); nbt.setInteger("spawnY", spawnLocation.y); nbt.setInteger("spawnZ", spawnLocation.z); nbt.setDouble("rotationX", rotation[0]); nbt.setDouble("rotationY", rotation[1]); nbt.setDouble("rotationZ", rotation[2]); nbt.setDouble("deltaRotationX", angularVelocity[0]); nbt.setDouble("deltaRotationY", angularVelocity[1]); nbt.setDouble("deltaRotationZ", angularVelocity[2]); }
Example 5
Source File: GrowingNodeBehavior.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
public void writeToNBT(NBTTagCompound nbtTagCompound) { nbtTagCompound.setBoolean("overallSaturated", isSaturated); nbtTagCompound.setDouble("overallHappiness", overallHappiness); if(lastFedAspect != null) { nbtTagCompound.setString("lastFedAspect", lastFedAspect.getTag()); nbtTagCompound.setInteger("lastFedRow", lastFedRow); } NBTTagList list = new NBTTagList(); for(Aspect a : aspectSaturation.keySet()) { double saturation = aspectSaturation.get(a); NBTTagCompound compound = new NBTTagCompound(); compound.setString("aspectName", a.getTag()); compound.setDouble("aspectSaturation", saturation); list.appendTag(compound); } nbtTagCompound.setTag("saturationValues", list); }
Example 6
Source File: CommonWorktableModule.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public NBTTagCompound serializeNBT() { NBTTagCompound compound = new NBTTagCompound(); if (hash != -1) { compound.setInteger("hash", hash); } if (module != null) compound.setString("module", module.getNBTKey()); if (pos != null) { compound.setDouble("x", pos.getX()); compound.setDouble("y", pos.getY()); } if (linksTo != null) compound.setTag("linksTo", linksTo.serializeNBT()); NBTTagCompound modifierNBT = new NBTTagCompound(); for (ModuleInstanceModifier modifier : modifiers.keySet()) { int count = modifiers.get(modifier); modifierNBT.setInteger(modifier.getNBTKey(), count); } compound.setTag("modifiers", modifierNBT); return compound; }
Example 7
Source File: WeaponHelper.java From Levels with GNU General Public License v2.0 | 5 votes |
public static void create(ItemStack stack, EntityPlayer player) { NBTTagCompound nbt = NBTHelper.loadStackNBT(stack); if (nbt != null) { Rarity rarity = Rarity.getRarity(nbt); Random rand = player.getEntityWorld().rand; if (rarity == Rarity.DEFAULT) { Rarity.setRarity(nbt, Rarity.getRandomRarity(nbt, rand)); // sets random rarity if (Rarity.getRarity(nbt) == Rarity.MYTHIC) { SPacketTitle packet = new SPacketTitle(SPacketTitle.Type.TITLE, new TextComponentString(TextFormatting.GOLD + "MYTHIC"), -1, 20, -1); EntityPlayerMP playermp = (EntityPlayerMP) player; playermp.connection.sendPacket(packet); Levels.network.sendTo(new PacketMythicSound(), (EntityPlayerMP) player); } if (Config.unlimitedDurability) { nbt.setInteger("Unbreakable", 1); // adds Unbreakable tag to item } Experience.setLevel(nbt, 1); nbt.setDouble("Multiplier", getWeightedMultiplier(Rarity.getRarity(nbt))); // adds a randomized multiplier to the item, weighted by rarity nbt.setInteger("HideFlags", 6); // hides Attribute Modifier and Unbreakable tags setAttributeModifiers(nbt, stack); // sets up Attribute Modifiers NBTHelper.saveStackNBT(stack, nbt); } } }
Example 8
Source File: BasicSink.java From Electro-Magic-Tools with GNU General Public License v3.0 | 5 votes |
/** * Forward for the base TileEntity's writeToNBT(), used for saving the state. * * @param tag Compound tag as supplied by TileEntity.writeToNBT() */ @Override public void 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); }
Example 9
Source File: IslandParameters.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public void writeToNBT(NBTTagCompound nbt) { int feat = 0; NBTTagCompound fnbt = new NBTTagCompound(); for(Feature ff : features) { fnbt.setBoolean(ff.toString(), true); } nbt.setTag("features", fnbt); nbt.setInteger("xCoord", xCoord); nbt.setInteger("zCoord", zCoord); nbt.setDouble("oceanRatio", oceanRatio); nbt.setDouble("lakeThreshold", lakeThreshold); nbt.setDouble("islandMaxHeight", islandMaxHeight); nbt.setInteger("surfaceRock", this.surfaceRock.getMeta()); nbt.setString("treeCommon", treeCommon); nbt.setString("treeUncommon", treeUncommon); nbt.setString("treeRare", treeRare); nbt.setInteger("moisture", moisture.ordinal()); nbt.setInteger("temp", temp.ordinal()); nbt.setLong("seed", seed); String animals = ""; for(int i = 0; i < animalTypes.size(); i++) { animals += animalTypes.get(i); if(i < animalTypes.size() - 1) animals += ","; } nbt.setString("animalTypes", animals); int[] cropArray = new int[cropList.size()]; for(int i = 0; i < cropArray.length; i++) { cropArray[i] = cropList.get(i).getID(); } nbt.setIntArray("crops", cropArray); }
Example 10
Source File: EntitySpellProjectile.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void writeCustomNBT(@Nonnull NBTTagCompound compound) { // Stupid Wawla, refusing to fix their problems... // https://github.com/micdoodle8/Galacticraft/commit/543e6afad64e51b02252a07489d0832fb93faa8d // https://github.com/Darkhax-Minecraft/WAWLA/issues/75 if (world.isRemote) return; compound.setTag("spell_ring", getSpellRing().serializeNBT()); compound.setTag("spell_data", getSpellData().serializeNBT()); compound.setDouble("distance", getDistance()); compound.setDouble("speed", getSpeed()); compound.setDouble("gravity", getGravity()); }
Example 11
Source File: Jetpack.java From SimplyJetpacks with MIT License | 5 votes |
@Override protected void writeConfigToNBT(NBTTagCompound tag) { super.writeConfigToNBT(tag); if (this.defaults.speedVertical != null) { tag.setDouble("SpeedVertical", this.speedVertical); } if (this.defaults.accelVertical != null) { tag.setDouble("AccelVertical", this.accelVertical); } if (this.defaults.speedVerticalHover != null) { tag.setDouble("SpeedVerticalHover", this.speedVerticalHover); } if (this.defaults.speedVerticalHoverSlow != null) { tag.setDouble("SpeedVerticalHoverSlow", this.speedVerticalHoverSlow); } if (this.defaults.speedSideways != null) { tag.setDouble("SpeedSideways", this.speedSideways); } if (this.defaults.sprintSpeedModifier != null) { tag.setDouble("SprintSpeedModifier", this.sprintSpeedModifier); } if (this.defaults.sprintFuelModifier != null) { tag.setDouble("SprintFuelModifier", this.sprintFuelModifier); } if (this.defaults.emergencyHoverMode != null) { tag.setBoolean("EmergencyHoverMode", this.emergencyHoverMode); } }
Example 12
Source File: TileRocketBuilder.java From AdvancedRocketry with MIT License | 5 votes |
@Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); stats.writeToNBT(nbt); nbt.setInteger("scanTime", progress); nbt.setInteger("scanTotalBlocks", totalProgress); nbt.setBoolean("building", building); nbt.setInteger("status", status.ordinal()); if(bbCache != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setDouble("minX", bbCache.minX); tag.setDouble("minY", bbCache.minY); tag.setDouble("minZ", bbCache.minZ); tag.setDouble("maxX", bbCache.maxX); tag.setDouble("maxY", bbCache.maxY); tag.setDouble("maxZ", bbCache.maxZ); nbt.setTag("bb", tag); } if(!blockPos.isEmpty()) { int[] array = new int[blockPos.size()*3]; int counter = 0; for(HashedBlockPosition pos : blockPos) { array[counter] = pos.x; array[counter+1] = pos.y; array[counter+2] = pos.z; counter += 3; } nbt.setIntArray("infrastructureLocations", array); } return nbt; }
Example 13
Source File: TileEntityRudderPart.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { NBTTagCompound toReturn = super.writeToNBT(compound); toReturn.setDouble("rudderAngle", rudderAngle); return toReturn; }
Example 14
Source File: TileElectricContainer.java From Production-Line with MIT License | 4 votes |
@Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt = super.writeToNBT(nbt); nbt.setDouble("energy", this.energy); return nbt; }
Example 15
Source File: EntityPotionCloud.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override protected void writeEntityToNBT(NBTTagCompound tag){ tag.setInteger("age", age); tag.setDouble("radius", radius); tag.setInteger("potionID", getPotionID()); }
Example 16
Source File: TileEntityBasicRotationTile.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound tagToSend = new NBTTagCompound(); tagToSend.setDouble("rotation", rotation); return new SPacketUpdateTileEntity(this.getPos(), 0, tagToSend); }
Example 17
Source File: NbtUtils.java From OpenModsLib with MIT License | 4 votes |
public static NBTTagCompound store(NBTTagCompound tag, double x, double y, double z) { tag.setDouble(TAG_X, x); tag.setDouble(TAG_Y, y); tag.setDouble(TAG_Z, z); return tag; }
Example 18
Source File: IElectricGrid.java From NEI-Integration with MIT License | 4 votes |
/** * Must be called by the owning object's save function. * * @param nbt */ public void writeToNBT(NBTTagCompound nbt) { NBTTagCompound tag = new NBTTagCompound(); tag.setDouble("charge", charge); nbt.setTag("chargeHandler", tag); }
Example 19
Source File: Center.java From TFC2 with GNU General Public License v3.0 | 4 votes |
public void writeToNBT(NBTTagCompound nbt) { nbt.setInteger("index", index); nbt.setInteger("biome", biome.ordinal()); nbt.setDouble("xCoord", point.x); nbt.setDouble("yCoord", point.y); long f = 0; for(Marker ff : flags) { f += ff.getFlag(); } nbt.setLong("flags", f); nbt.setDouble("elevation", elevation); nbt.setFloat("moisture", moisture); nbt.setBoolean("hasGenerated", hasGenerated); if(downslope != null) nbt.setInteger("downslope", downslope.index); int[] nArray = new int[neighbors.size()]; for(int i = 0; i < nArray.length; i++) { nArray[i] = neighbors.get(i).index; } nbt.setIntArray("neighbors", nArray); nArray = new int[corners.size()]; for(int i = 0; i < nArray.length; i++) { nArray[i] = corners.get(i).index; } nbt.setIntArray("corners", nArray); nArray = new int[borders.size()]; for(int i = 0; i < nArray.length; i++) { nArray[i] = borders.get(i).index; } nbt.setIntArray("borders", nArray); Iterator<Attribute> iter = attribMap.values().iterator(); NBTTagList attribList = new NBTTagList(); while(iter.hasNext()) { Attribute a = iter.next(); NBTTagCompound attribNBT = new NBTTagCompound(); attribNBT.setString("class", a.getClass().getName()); a.writeToNBT(attribNBT); attribList.appendTag(attribNBT); } nbt.setTag("attribMap", attribList); nbt.setTag("CustomData", this.customNBT); }
Example 20
Source File: IElectricMinecart.java From NEI-Integration with MIT License | 2 votes |
/** * Must be called by the owning object's save function. * <p> * <blockquote><pre> * {@code * public void writeEntityToNBT(NBTTagCompound data) * { * super.writeEntityToNBT(data); * chargeHandler.writeToNBT(data); * } * } * </pre></blockquote> * <p> * @param nbt */ public void writeToNBT(NBTTagCompound nbt) { NBTTagCompound tag = new NBTTagCompound(); tag.setDouble("charge", charge); nbt.setTag("chargeHandler", tag); }