/** (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setByte("Dir", (byte) direction); par1NBTTagCompound.setString("Motive", art.title); par1NBTTagCompound.setInteger("TileX", xPosition); par1NBTTagCompound.setInteger("TileY", yPosition); par1NBTTagCompound.setInteger("TileZ", zPosition); }
public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setTag("Inventory", inventory.writeToNBT(new NBTTagList())); nbttagcompound.setInteger("Dimension", dimension); nbttagcompound.setBoolean("Sleeping", sleeping); nbttagcompound.setShort("SleepTimer", (short) sleepTimer); nbttagcompound.setFloat("XpP", currentXP); nbttagcompound.setInteger("XpLevel", playerLevel); nbttagcompound.setInteger("XpTotal", totalXP); if (playerSpawnCoordinate != null) { nbttagcompound.setInteger("SpawnX", playerSpawnCoordinate.posX); nbttagcompound.setInteger("SpawnY", playerSpawnCoordinate.posY); nbttagcompound.setInteger("SpawnZ", playerSpawnCoordinate.posZ); } foodStats.writeStatsToNBT(nbttagcompound); capabilities.writeCapabilitiesToNBT(nbttagcompound); }
private void setBlockMeta(NBTTagCompound tagCompound, BlockMeta blockMeta, String name) { tagCompound.setInteger(name, Block.blockRegistry.getIDForObject(blockMeta.getBlock())); tagCompound.setInteger(name + "_meta", blockMeta.getMeta()); }
public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setInteger("playerGameType", itemInWorldManager.getGameType()); }
public void writeToNBT(NBTTagCompound tagCompound) { tagCompound.setString("name", getName()); Coordinate spawnPoint = getSpawnPoint(); if (spawnPoint != null) { Coordinate.writeToNBT(tagCompound, "spawnPoint", spawnPoint); } tagCompound.setInteger("probeCounter", getProbeCounter()); tagCompound.setInteger( "version", 1); // Version number so that we can detect incompatible changes in persisted dimension // information objects. tagCompound.setInteger( "terrain", terrainType == null ? TerrainType.TERRAIN_VOID.ordinal() : terrainType.ordinal()); tagCompound.setIntArray("features", toIntArray(featureTypes)); tagCompound.setIntArray("structures", toIntArray(structureTypes)); tagCompound.setIntArray("effects", toIntArray(effectTypes)); List<Integer> c = new ArrayList<Integer>(biomes.size()); for (BiomeGenBase t : biomes) { if (t != null) { c.add(t.biomeID); } else { c.add(BiomeGenBase.plains.biomeID); } } tagCompound.setIntArray("biomes", ArrayUtils.toPrimitive(c.toArray(new Integer[c.size()]))); tagCompound.setInteger( "controller", controllerType == null ? ControllerType.CONTROLLER_DEFAULT.ordinal() : controllerType.ordinal()); tagCompound.setString("digits", digitString); tagCompound.setLong("forcedSeed", forcedDimensionSeed); tagCompound.setLong("baseSeed", baseSeed); tagCompound.setInteger("worldVersion", worldVersion); setBlockMeta(tagCompound, baseBlockForTerrain, "baseBlock"); setBlockMeta(tagCompound, tendrilBlock, "tendrilBlock"); writeBlocksToNBT(tagCompound, pyramidBlocks, "pyramidBlocks"); writeBlocksToNBT(tagCompound, sphereBlocks, "sphereBlocks"); if (sphereBlocks.length > 0) { // Write out a single sphere block for compatibility with older RFTools. setBlockMeta(tagCompound, sphereBlocks[0], "sphereBlock"); } writeBlocksToNBT(tagCompound, hugeSphereBlocks, "hugeSphereBlocks"); writeBlocksToNBT(tagCompound, hugeLiquidSphereBlocks, "hugeLiquidSphereBlocks"); writeFluidsToNBT(tagCompound, hugeLiquidSphereFluids, "hugeLiquidSphereFluids"); writeBlocksToNBT(tagCompound, liquidSphereBlocks, "liquidSphereBlocks"); if (liquidSphereBlocks.length > 0) { // Write out a single sphere block for compatibility with older RFTools. setBlockMeta(tagCompound, liquidSphereBlocks[0], "liquidSphereBlock"); } writeFluidsToNBT(tagCompound, liquidSphereFluids, "liquidSphereFluids"); if (liquidSphereFluids.length > 0) { tagCompound.setInteger( "liquidSphereFluid", Block.blockRegistry.getIDForObject(liquidSphereFluids[0])); } setBlockMeta(tagCompound, canyonBlock, "canyonBlock"); tagCompound.setInteger("fluidBlock", Block.blockRegistry.getIDForObject(fluidForTerrain)); writeBlocksToNBT(tagCompound, extraOregen, "extraOregen"); writeFluidsToNBT(tagCompound, fluidsForLakes, "lakeFluids"); tagCompound.setBoolean("peaceful", peaceful); tagCompound.setBoolean("noanimals", noanimals); tagCompound.setBoolean("shelter", shelter); tagCompound.setBoolean("respawnHere", respawnHere); if (celestialAngle != null) { tagCompound.setFloat("celestialAngle", celestialAngle); } if (timeSpeed != null) { tagCompound.setFloat("timeSpeed", timeSpeed); } tagCompound.setInteger("probes", probeCounter); tagCompound.setInteger("actualCost", actualRfCost); skyDescriptor.writeToNBT(tagCompound); weatherDescriptor.writeToNBT(tagCompound); tagCompound.setLong("patreon1", patreon1); NBTTagList list = new NBTTagList(); for (MobDescriptor mob : extraMobs) { NBTTagCompound tc = new NBTTagCompound(); if (mob != null) { if (mob.getEntityClass() != null) { tc.setString("class", mob.getEntityClass().getName()); tc.setInteger("chance", mob.getSpawnChance()); tc.setInteger("minGroup", mob.getMinGroup()); tc.setInteger("maxGroup", mob.getMaxGroup()); tc.setInteger("maxLoaded", mob.getMaxLoaded()); list.appendTag(tc); } } } tagCompound.setTag("mobs", list); tagCompound.setString("dimensionTypes", StringUtils.join(dimensionTypes, ",")); }