public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) { TileEntity tileentity = null; try { var class1 = (Class)nameToClassMap.get(nbttagcompound.getString("id")); if (class1 != null) { tileentity = (TileEntity)class1.newInstance(); } } catch (Exception exception) { exception.printStackTrace(); } if (tileentity != null) { tileentity.readFromNBT(nbttagcompound); } else { [email protected]( (new StringBuilder()).append("Skipping TileEntity with id ").append(nbttagcompound.getString("id")). toString()); } return(tileentity); }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { direction = nbttagcompound.getByte("Dir"); xPosition = nbttagcompound.getInteger("TileX"); yPosition = nbttagcompound.getInteger("TileY"); zPosition = nbttagcompound.getInteger("TileZ"); string s = nbttagcompound.getString("Motive"); EnumArt[] aenumart = EnumArt.values(); int i = aenumart.Length; for (int j = 0; j < i; j++) { EnumArt enumart = aenumart[j]; if (enumart.title.Equals(s)) { art = enumart; } } if (art == null) { art = EnumArt.Kebab; } func_179_a(direction); }
public virtual void func_22094_a(WorldInfo worldinfo) { NBTTagCompound nbttagcompound = worldinfo.func_22185_a(); var nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setTag("Data", nbttagcompound); try { var file = new File(field_22099_b, "level.dat_new"); var file1 = new File(field_22099_b, "level.dat_old"); var file2 = new File(field_22099_b, "level.dat"); CompressedStreamTools.writeGzippedCompoundToOutputStream(nbttagcompound1, new FileOutputStream(file)); if (file1.exists()) { file1.delete(); } file2.renameTo(file1); if (file2.exists()) { file2.delete(); } file.renameTo(file2); if (file.exists()) { file.delete(); } } catch (Exception exception) { exception.printStackTrace(); } }
public static Entity createEntityFromNBT(NBTTagCompound nbttagcompound, World world) { Entity entity = null; try { var class1 = (Class) stringToClassMapping.get(nbttagcompound.getString("id")); if (class1 != null) { entity = (Entity) class1.getConstructor(new Class[] { typeof (World) }).newInstance(new object[] { world }); } } catch (Exception exception) { exception.printStackTrace(); } if (entity != null) { entity.readFromNBT(nbttagcompound); } else { [email protected]( (new StringBuilder()).append("Skipping Entity with id ").append(nbttagcompound.getString("id")). toString()); } return entity; }
public NBTTagCompound func_22185_a() { var nbttagcompound = new NBTTagCompound(); func_22176_a(nbttagcompound, field_22195_h); return(nbttagcompound); }
public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound) { TileEntity tileentity = null; try { var class1 = (Class) nameToClassMap.get(nbttagcompound.getString("id")); if (class1 != null) { tileentity = (TileEntity) class1.newInstance(); } } catch (Exception exception) { exception.printStackTrace(); } if (tileentity != null) { tileentity.readFromNBT(nbttagcompound); } else { [email protected]( (new StringBuilder()).append("Skipping TileEntity with id ").append(nbttagcompound.getString("id")). toString()); } return tileentity; }
public virtual void readFromNBT(NBTTagCompound nbttagcompound) { NBTTagList nbttaglist = nbttagcompound.getTagList("Pos"); NBTTagList nbttaglist1 = nbttagcompound.getTagList("Motion"); NBTTagList nbttaglist2 = nbttagcompound.getTagList("Rotation"); setPosition(0.0D, 0.0D, 0.0D); motionX = ((NBTTagDouble)nbttaglist1.tagAt(0)).doubleValue; motionY = ((NBTTagDouble)nbttaglist1.tagAt(1)).doubleValue; motionZ = ((NBTTagDouble)nbttaglist1.tagAt(2)).doubleValue; if (Math.abs(motionX) > 10D) { motionX = 0.0D; } if (Math.abs(motionY) > 10D) { motionY = 0.0D; } if (Math.abs(motionZ) > 10D) { motionZ = 0.0D; } prevPosX = lastTickPosX = posX = ((NBTTagDouble)nbttaglist.tagAt(0)).doubleValue; prevPosY = lastTickPosY = posY = ((NBTTagDouble)nbttaglist.tagAt(1)).doubleValue; prevPosZ = lastTickPosZ = posZ = ((NBTTagDouble)nbttaglist.tagAt(2)).doubleValue; prevRotationYaw = rotationYaw = ((NBTTagFloat)nbttaglist2.tagAt(0)).floatValue % 6.283185F; prevRotationPitch = rotationPitch = ((NBTTagFloat)nbttaglist2.tagAt(1)).floatValue % 6.283185F; fallDistance = nbttagcompound.getFloat("FallDistance"); fire = nbttagcompound.getShort("Fire"); air = nbttagcompound.getShort("Air"); onGround = nbttagcompound.getBoolean("OnGround"); setPosition(posX, posY, posZ); readEntityFromNBT(nbttagcompound); }
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("id", (short)itemID); nbttagcompound.setByte("Count", (byte)stackSize); nbttagcompound.setShort("Damage", (short)itemDamage); return(nbttagcompound); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setInteger("Type", minecartType); if (minecartType == 2) { nbttagcompound.setDouble("PushX", pushX); nbttagcompound.setDouble("PushZ", pushZ); nbttagcompound.setShort("Fuel", (short)fuel); } else if (minecartType == 1) { var nbttaglist = new NBTTagList(); for (int i = 0; i < cargoItems.Length; i++) { if (cargoItems[i] != null) { var nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); cargoItems[i].writeToNBT(nbttagcompound1); nbttaglist.setTag(nbttagcompound1); } } nbttagcompound.setTag("Items", nbttaglist); } }
public WorldInfo func_22103_b(string s) { var file = new File(field_22106_a, s); if (!file.exists()) { return(null); } var file1 = new File(file, "level.dat"); if (file1.exists()) { try { NBTTagCompound nbttagcompound = CompressedStreamTools.func_770_a(new FileInputStream(file1)); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); return(new WorldInfo(nbttagcompound1)); } catch (Exception exception) { exception.printStackTrace(); } } return(null); }
public void saveChunk(World world, Chunk chunk) { world.checkSessionLock(); File file = chunkFileForXZ(chunk.xPosition, chunk.zPosition); if (file.exists()) { WorldInfo worldinfo = world.getWorldInfo(); worldinfo.func_22177_b(worldinfo.func_22182_g() - file.length()); } try { var file1 = new File(saveDir, "tmp_chunk.dat"); var fileoutputstream = new FileOutputStream(file1); var nbttagcompound = new NBTTagCompound(); var nbttagcompound1 = new NBTTagCompound(); nbttagcompound.setTag("Level", nbttagcompound1); storeChunkInCompound(chunk, world, nbttagcompound1); CompressedStreamTools.writeGzippedCompoundToOutputStream(nbttagcompound, fileoutputstream); fileoutputstream.close(); if (file.exists()) { file.delete(); } file1.renameTo(file); WorldInfo worldinfo1 = world.getWorldInfo(); worldinfo1.func_22177_b(worldinfo1.func_22182_g() + file.length()); } catch (Exception exception) { exception.printStackTrace(); } }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("Health", (short)health); nbttagcompound.setShort("HurtTime", (short)hurtTime); nbttagcompound.setShort("DeathTime", (short)deathTime); nbttagcompound.setShort("AttackTime", (short)attackTime); }
public static Entity createEntityFromNBT(NBTTagCompound nbttagcompound, World world) { Entity entity = null; try { var class1 = (Class)stringToClassMapping.get(nbttagcompound.getString("id")); if (class1 != null) { entity = (Entity)class1.getConstructor(new Class[] { typeof(World) }).newInstance(new object[] { world }); } } catch (Exception exception) { exception.printStackTrace(); } if (entity != null) { entity.readFromNBT(nbttagcompound); } else { [email protected]( (new StringBuilder()).append("Skipping Entity with id ").append(nbttagcompound.getString("id")). toString()); } return(entity); }
public override void writeToNBT(NBTTagCompound nbttagcompound) { base.writeToNBT(nbttagcompound); nbttagcompound.setString("Text1", signText[0]); nbttagcompound.setString("Text2", signText[1]); nbttagcompound.setString("Text3", signText[2]); nbttagcompound.setString("Text4", signText[3]); }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { health = nbttagcompound.getShort("Health") & 0xff; age = nbttagcompound.getShort("Age"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Item"); item = new ItemStack(nbttagcompound1); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setByte("Dir", (byte)direction); nbttagcompound.setString("Motive", art.title); nbttagcompound.setInteger("TileX", xPosition); nbttagcompound.setInteger("TileY", yPosition); nbttagcompound.setInteger("TileZ", zPosition); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { base.writeEntityToNBT(nbttagcompound); nbttagcompound.setTag("Inventory", inventory.writeToNBT(new NBTTagList())); nbttagcompound.setInteger("Dimension", dimension); nbttagcompound.setBoolean("Sleeping", sleeping); nbttagcompound.setShort("SleepTimer", (short)sleepTimer); }
public static Chunk loadChunkIntoWorldFromCompound(World world, NBTTagCompound nbttagcompound) { int i = nbttagcompound.getInteger("xPos"); int j = nbttagcompound.getInteger("zPos"); var chunk = new Chunk(world, i, j); chunk.blocks = nbttagcompound.getByteArray("Blocks"); chunk.data = new NibbleArray(nbttagcompound.getByteArray("Data")); chunk.skylightMap = new NibbleArray(nbttagcompound.getByteArray("SkyLight")); chunk.blocklightMap = new NibbleArray(nbttagcompound.getByteArray("BlockLight")); chunk.heightMap = nbttagcompound.getByteArray("HeightMap"); chunk.isTerrainPopulated = nbttagcompound.getBoolean("TerrainPopulated"); if (!chunk.data.isValid()) { chunk.data = new NibbleArray(chunk.blocks.Length); } if (chunk.heightMap == null || !chunk.skylightMap.isValid()) { chunk.heightMap = new byte[256]; chunk.skylightMap = new NibbleArray(chunk.blocks.Length); chunk.func_353_b(); } if (!chunk.blocklightMap.isValid()) { chunk.blocklightMap = new NibbleArray(chunk.blocks.Length); chunk.func_348_a(); } NBTTagList nbttaglist = nbttagcompound.getTagList("Entities"); if (nbttaglist != null) { for (int k = 0; k < nbttaglist.tagCount(); k++) { var nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(k); Entity entity = EntityList.createEntityFromNBT(nbttagcompound1, world); chunk.hasEntities = true; if (entity != null) { chunk.addEntity(entity); } } } NBTTagList nbttaglist1 = nbttagcompound.getTagList("TileEntities"); if (nbttaglist1 != null) { for (int l = 0; l < nbttaglist1.tagCount(); l++) { var nbttagcompound2 = (NBTTagCompound)nbttaglist1.tagAt(l); TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound2); if (tileentity != null) { chunk.func_349_a(tileentity); } } } return(chunk); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("xTile", (short)xTile); nbttagcompound.setShort("yTile", (short)yTile); nbttagcompound.setShort("zTile", (short)zTile); nbttagcompound.setByte("inTile", (byte)inTile); nbttagcompound.setByte("shake", (byte)arrowShake); nbttagcompound.setByte("inGround", (byte)(inGround ? 1 : 0)); }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { xTile = nbttagcompound.getShort("xTile"); yTile = nbttagcompound.getShort("yTile"); zTile = nbttagcompound.getShort("zTile"); inTile = nbttagcompound.getByte("inTile") & 0xff; arrowShake = nbttagcompound.getByte("shake") & 0xff; inGround = nbttagcompound.getByte("inGround") == 1; }
public static Chunk loadChunkIntoWorldFromCompound(World world, NBTTagCompound nbttagcompound) { int i = nbttagcompound.getInteger("xPos"); int j = nbttagcompound.getInteger("zPos"); var chunk = new Chunk(world, i, j); chunk.blocks = nbttagcompound.getByteArray("Blocks"); chunk.data = new NibbleArray(nbttagcompound.getByteArray("Data")); chunk.skylightMap = new NibbleArray(nbttagcompound.getByteArray("SkyLight")); chunk.blocklightMap = new NibbleArray(nbttagcompound.getByteArray("BlockLight")); chunk.heightMap = nbttagcompound.getByteArray("HeightMap"); chunk.isTerrainPopulated = nbttagcompound.getBoolean("TerrainPopulated"); if (!chunk.data.isValid()) { chunk.data = new NibbleArray(chunk.blocks.Length); } if (chunk.heightMap == null || !chunk.skylightMap.isValid()) { chunk.heightMap = new byte[256]; chunk.skylightMap = new NibbleArray(chunk.blocks.Length); chunk.func_353_b(); } if (!chunk.blocklightMap.isValid()) { chunk.blocklightMap = new NibbleArray(chunk.blocks.Length); chunk.func_348_a(); } NBTTagList nbttaglist = nbttagcompound.getTagList("Entities"); if (nbttaglist != null) { for (int k = 0; k < nbttaglist.tagCount(); k++) { var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(k); Entity entity = EntityList.createEntityFromNBT(nbttagcompound1, world); chunk.hasEntities = true; if (entity != null) { chunk.addEntity(entity); } } } NBTTagList nbttaglist1 = nbttagcompound.getTagList("TileEntities"); if (nbttaglist1 != null) { for (int l = 0; l < nbttaglist1.tagCount(); l++) { var nbttagcompound2 = (NBTTagCompound) nbttaglist1.tagAt(l); TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound2); if (tileentity != null) { chunk.func_349_a(tileentity); } } } return chunk; }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { health = nbttagcompound.getShort("Health"); if (!nbttagcompound.hasKey("Health")) { health = 10; } hurtTime = nbttagcompound.getShort("HurtTime"); deathTime = nbttagcompound.getShort("DeathTime"); attackTime = nbttagcompound.getShort("AttackTime"); }
public override void readFromNBT(NBTTagCompound nbttagcompound) { base.readFromNBT(nbttagcompound); for (int i = 0; i < 4; i++) { signText[i] = nbttagcompound.getString((new StringBuilder()).append("Text").append(i + 1).toString()); if (signText[i].Length > 15) { signText[i] = signText[i].Substring(0, 15); } } }
public static void writeGzippedCompoundToOutputStream(NBTTagCompound nbttagcompound, OutputStream outputstream) { var dataoutputstream = new DataOutputStream(new GZIPOutputStream(outputstream)); try { func_771_a(nbttagcompound, dataoutputstream); } finally { dataoutputstream.close(); } }
public static void storeChunkInCompound(Chunk chunk, World world, NBTTagCompound nbttagcompound) { world.checkSessionLock(); nbttagcompound.setInteger("xPos", chunk.xPosition); nbttagcompound.setInteger("zPos", chunk.zPosition); nbttagcompound.setLong("LastUpdate", world.getWorldTime()); nbttagcompound.setByteArray("Blocks", chunk.blocks); nbttagcompound.setByteArray("Data", chunk.data.data); nbttagcompound.setByteArray("SkyLight", chunk.skylightMap.data); nbttagcompound.setByteArray("BlockLight", chunk.blocklightMap.data); nbttagcompound.setByteArray("HeightMap", chunk.heightMap); nbttagcompound.setBoolean("TerrainPopulated", chunk.isTerrainPopulated); chunk.hasEntities = false; var nbttaglist = new NBTTagList(); for (int i = 0; i < chunk.entities.Length; i++) { Iterator iterator = chunk.entities[i].iterator(); do { if (!iterator.hasNext()) { goto label0; } var entity = (Entity)iterator.next(); chunk.hasEntities = true; var nbttagcompound1 = new NBTTagCompound(); if (entity.addEntityID(nbttagcompound1)) { nbttaglist.setTag(nbttagcompound1); } } while (true); } label0: nbttagcompound.setTag("Entities", nbttaglist); var nbttaglist1 = new NBTTagList(); NBTTagCompound nbttagcompound2; for (Iterator iterator1 = chunk.chunkTileEntityMap.values().iterator(); iterator1.hasNext(); nbttaglist1.setTag(nbttagcompound2)) { var tileentity = (TileEntity)iterator1.next(); nbttagcompound2 = new NBTTagCompound(); tileentity.writeToNBT(nbttagcompound2); } nbttagcompound.setTag("TileEntities", nbttaglist1); }
public WorldInfo(WorldInfo worldinfo) { randomSeed = worldinfo.randomSeed; spawnX = worldinfo.spawnX; spawnY = worldinfo.spawnY; spawnZ = worldinfo.spawnZ; worldTime = worldinfo.worldTime; lastPlayed = worldinfo.lastPlayed; sizeOnDisk = worldinfo.sizeOnDisk; field_22195_h = worldinfo.field_22195_h; field_22194_i = worldinfo.field_22194_i; levelName = worldinfo.levelName; version = worldinfo.version; }
public static NBTTagCompound func_770_a(InputStream inputstream) { var datainputstream = new DataInputStream(new GZIPInputStream(inputstream)); try { NBTTagCompound nbttagcompound = func_774_a(datainputstream); return(nbttagcompound); } finally { datainputstream.close(); } }
public static void storeChunkInCompound(Chunk chunk, World world, NBTTagCompound nbttagcompound) { world.checkSessionLock(); nbttagcompound.setInteger("xPos", chunk.xPosition); nbttagcompound.setInteger("zPos", chunk.zPosition); nbttagcompound.setLong("LastUpdate", world.getWorldTime()); nbttagcompound.setByteArray("Blocks", chunk.blocks); nbttagcompound.setByteArray("Data", chunk.data.data); nbttagcompound.setByteArray("SkyLight", chunk.skylightMap.data); nbttagcompound.setByteArray("BlockLight", chunk.blocklightMap.data); nbttagcompound.setByteArray("HeightMap", chunk.heightMap); nbttagcompound.setBoolean("TerrainPopulated", chunk.isTerrainPopulated); chunk.hasEntities = false; var nbttaglist = new NBTTagList(); for (int i = 0; i < chunk.entities.Length; i++) { Iterator iterator = chunk.entities[i].iterator(); do { if (!iterator.hasNext()) { goto label0; } var entity = (Entity) iterator.next(); chunk.hasEntities = true; var nbttagcompound1 = new NBTTagCompound(); if (entity.addEntityID(nbttagcompound1)) { nbttaglist.setTag(nbttagcompound1); } } while (true); } label0: nbttagcompound.setTag("Entities", nbttaglist); var nbttaglist1 = new NBTTagList(); NBTTagCompound nbttagcompound2; for (Iterator iterator1 = chunk.chunkTileEntityMap.values().iterator(); iterator1.hasNext(); nbttaglist1.setTag(nbttagcompound2)) { var tileentity = (TileEntity) iterator1.next(); nbttagcompound2 = new NBTTagCompound(); tileentity.writeToNBT(nbttagcompound2); } nbttagcompound.setTag("TileEntities", nbttaglist1); }
public virtual bool addEntityID(NBTTagCompound nbttagcompound) { string s = getEntityString(); if (isDead || s == null) { return(false); } else { nbttagcompound.setString("id", s); writeToNBT(nbttagcompound); return(true); } }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { base.readEntityFromNBT(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory"); inventory.readFromNBT(nbttaglist); dimension = nbttagcompound.getInteger("Dimension"); sleeping = nbttagcompound.getBoolean("Sleeping"); sleepTimer = nbttagcompound.getShort("SleepTimer"); if (sleeping) { playerLocation = new ChunkCoordinates(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)); wakeUpPlayer(true, true); } }
private void func_22176_a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { nbttagcompound.setLong("RandomSeed", randomSeed); nbttagcompound.setInteger("SpawnX", spawnX); nbttagcompound.setInteger("SpawnY", spawnY); nbttagcompound.setInteger("SpawnZ", spawnZ); nbttagcompound.setLong("Time", worldTime); nbttagcompound.setLong("SizeOnDisk", sizeOnDisk); nbttagcompound.setLong("LastPlayed", java.lang.System.currentTimeMillis()); nbttagcompound.setString("LevelName", levelName); nbttagcompound.setInteger("version", version); if (nbttagcompound1 != null) { nbttagcompound.setCompoundTag("Player", nbttagcompound1); } }
public override void readFromNBT(NBTTagCompound nbttagcompound) { base.readFromNBT(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); dispenserContents = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { var nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; if (j >= 0 && j < dispenserContents.Length) { dispenserContents[j] = new ItemStack(nbttagcompound1); } } }
public WorldInfo(NBTTagCompound nbttagcompound) { randomSeed = nbttagcompound.getLong("RandomSeed"); spawnX = nbttagcompound.getInteger("SpawnX"); spawnY = nbttagcompound.getInteger("SpawnY"); spawnZ = nbttagcompound.getInteger("SpawnZ"); worldTime = nbttagcompound.getLong("Time"); lastPlayed = nbttagcompound.getLong("LastPlayed"); sizeOnDisk = nbttagcompound.getLong("SizeOnDisk"); levelName = nbttagcompound.getString("LevelName"); version = nbttagcompound.getInteger("version"); if (nbttagcompound.hasKey("Player")) { field_22195_h = nbttagcompound.getCompoundTag("Player"); field_22194_i = field_22195_h.getInteger("Dimension"); } }
public NBTTagCompound func_22183_a(List list) { var nbttagcompound = new NBTTagCompound(); EntityPlayer entityplayer = null; NBTTagCompound nbttagcompound1 = null; if (list.size() > 0) { entityplayer = (EntityPlayer) list.get(0); } if (entityplayer != null) { nbttagcompound1 = new NBTTagCompound(); entityplayer.writeToNBT(nbttagcompound1); } func_22176_a(nbttagcompound, nbttagcompound1); return nbttagcompound; }
public Chunk loadChunk(World world, int i, int j) { File file = chunkFileForXZ(i, j); if (file != null && file.exists()) { try { var fileinputstream = new FileInputStream(file); NBTTagCompound nbttagcompound = CompressedStreamTools.func_770_a(fileinputstream); if (!nbttagcompound.hasKey("Level")) { [email protected]( (new StringBuilder()).append("Chunk file at ").append(i).append(",").append(j).append( " is missing level data, skipping").toString()); return(null); } if (!nbttagcompound.getCompoundTag("Level").hasKey("Blocks")) { [email protected]( (new StringBuilder()).append("Chunk file at ").append(i).append(",").append(j).append( " is missing block data, skipping").toString()); return(null); } Chunk chunk = loadChunkIntoWorldFromCompound(world, nbttagcompound.getCompoundTag("Level")); if (!chunk.isAtLocation(i, j)) { [email protected]( (new StringBuilder()).append("Chunk file at ").append(i).append(",").append(j).append( " is in the wrong location; relocating. (Expected ").append(i).append(", ").append(j). append(", got ").append(chunk.xPosition).append(", ").append(chunk.zPosition).append(")") .toString()); nbttagcompound.setInteger("xPos", i); nbttagcompound.setInteger("zPos", j); chunk = loadChunkIntoWorldFromCompound(world, nbttagcompound.getCompoundTag("Level")); } return(chunk); } catch (Exception exception) { exception.printStackTrace(); } } return(null); }
public void saveChunk(World world, Chunk chunk) { world.checkSessionLock(); try { DataOutputStream dataoutputstream = RegionFileCache.func_22120_d(field_22110_a, chunk.xPosition, chunk.zPosition); var nbttagcompound = new NBTTagCompound(); var nbttagcompound1 = new NBTTagCompound(); nbttagcompound.setTag("Level", nbttagcompound1); ChunkLoader.storeChunkInCompound(chunk, world, nbttagcompound1); CompressedStreamTools.func_771_a(nbttagcompound, dataoutputstream); dataoutputstream.close(); WorldInfo worldinfo = world.getWorldInfo(); worldinfo.func_22177_b(worldinfo.func_22182_g() + RegionFileCache.func_22121_b(field_22110_a, chunk.xPosition, chunk.zPosition)); } catch (Exception exception) { exception.printStackTrace(); } }
public void readFromNBT(NBTTagCompound nbttagcompound) { itemID = nbttagcompound.getShort("id"); stackSize = nbttagcompound.getByte("Count"); itemDamage = nbttagcompound.getShort("Damage"); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setInteger("Type", minecartType); if (minecartType == 2) { nbttagcompound.setDouble("PushX", pushX); nbttagcompound.setDouble("PushZ", pushZ); nbttagcompound.setShort("Fuel", (short) fuel); } else if (minecartType == 1) { var nbttaglist = new NBTTagList(); for (int i = 0; i < cargoItems.Length; i++) { if (cargoItems[i] != null) { var nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); cargoItems[i].writeToNBT(nbttagcompound1); nbttaglist.setTag(nbttagcompound1); } } nbttagcompound.setTag("Items", nbttaglist); } }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { minecartType = nbttagcompound.getInteger("Type"); if (minecartType == 2) { pushX = nbttagcompound.getDouble("PushX"); pushZ = nbttagcompound.getDouble("PushZ"); fuel = nbttagcompound.getShort("Fuel"); } else if (minecartType == 1) { NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); cargoItems = new ItemStack[getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); i++) { var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i); int j = nbttagcompound1.getByte("Slot") & 0xff; if (j >= 0 && j < cargoItems.Length) { cargoItems[j] = new ItemStack(nbttagcompound1); } } } }
public NBTTagCompound func_22185_a() { var nbttagcompound = new NBTTagCompound(); func_22176_a(nbttagcompound, field_22195_h); return nbttagcompound; }
public virtual void readFromNBT(NBTTagCompound nbttagcompound) { NBTTagList nbttaglist = nbttagcompound.getTagList("Pos"); NBTTagList nbttaglist1 = nbttagcompound.getTagList("Motion"); NBTTagList nbttaglist2 = nbttagcompound.getTagList("Rotation"); setPosition(0.0D, 0.0D, 0.0D); motionX = ((NBTTagDouble) nbttaglist1.tagAt(0)).doubleValue; motionY = ((NBTTagDouble) nbttaglist1.tagAt(1)).doubleValue; motionZ = ((NBTTagDouble) nbttaglist1.tagAt(2)).doubleValue; if (Math.abs(motionX) > 10D) { motionX = 0.0D; } if (Math.abs(motionY) > 10D) { motionY = 0.0D; } if (Math.abs(motionZ) > 10D) { motionZ = 0.0D; } prevPosX = lastTickPosX = posX = ((NBTTagDouble) nbttaglist.tagAt(0)).doubleValue; prevPosY = lastTickPosY = posY = ((NBTTagDouble) nbttaglist.tagAt(1)).doubleValue; prevPosZ = lastTickPosZ = posZ = ((NBTTagDouble) nbttaglist.tagAt(2)).doubleValue; prevRotationYaw = rotationYaw = ((NBTTagFloat) nbttaglist2.tagAt(0)).floatValue%6.283185F; prevRotationPitch = rotationPitch = ((NBTTagFloat) nbttaglist2.tagAt(1)).floatValue%6.283185F; fallDistance = nbttagcompound.getFloat("FallDistance"); fire = nbttagcompound.getShort("Fire"); air = nbttagcompound.getShort("Air"); onGround = nbttagcompound.getBoolean("OnGround"); setPosition(posX, posY, posZ); readEntityFromNBT(nbttagcompound); }
public abstract void readEntityFromNBT(NBTTagCompound nbttagcompound);
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { base.writeEntityToNBT(nbttagcompound); nbttagcompound.setTag("Inventory", inventory.writeToNBT(new NBTTagList())); nbttagcompound.setInteger("Dimension", dimension); nbttagcompound.setBoolean("Sleeping", sleeping); nbttagcompound.setShort("SleepTimer", (short) sleepTimer); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("Health", (byte) health); nbttagcompound.setShort("Age", (short) age); nbttagcompound.setCompoundTag("Item", item.writeToNBT(new NBTTagCompound())); }
public virtual void writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setTag("Pos", newDoubleNBTList(new[] { posX, posY, posZ })); nbttagcompound.setTag("Motion", newDoubleNBTList(new[] { motionX, motionY, motionZ })); nbttagcompound.setTag("Rotation", newFloatNBTList(new[] { rotationYaw, rotationPitch })); nbttagcompound.setFloat("FallDistance", fallDistance); nbttagcompound.setShort("Fire", (short) fire); nbttagcompound.setShort("Air", (short) air); nbttagcompound.setBoolean("OnGround", onGround); writeEntityToNBT(nbttagcompound); }
public override void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("xTile", (short) xTileSnowball); nbttagcompound.setShort("yTile", (short) yTileSnowball); nbttagcompound.setShort("zTile", (short) zTileSnowball); nbttagcompound.setByte("inTile", (byte) inTileSnowball); nbttagcompound.setByte("shake", (byte) shakeSnowball); nbttagcompound.setByte("inGround", (byte) (inGroundSnowball ? 1 : 0)); }
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { xTileSnowball = nbttagcompound.getShort("xTile"); yTileSnowball = nbttagcompound.getShort("yTile"); zTileSnowball = nbttagcompound.getShort("zTile"); inTileSnowball = nbttagcompound.getByte("inTile") & 0xff; shakeSnowball = nbttagcompound.getByte("shake") & 0xff; inGroundSnowball = nbttagcompound.getByte("inGround") == 1; }
public abstract void writeEntityToNBT(NBTTagCompound nbttagcompound);
public override void readEntityFromNBT(NBTTagCompound nbttagcompound) { }
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("id", (short) itemID); nbttagcompound.setByte("Count", (byte) stackSize); nbttagcompound.setShort("Damage", (short) itemDamage); return nbttagcompound; }
public ItemStack(NBTTagCompound nbttagcompound) { stackSize = 0; readFromNBT(nbttagcompound); }
public virtual bool addEntityID(NBTTagCompound nbttagcompound) { string s = getEntityString(); if (isDead || s == null) { return false; } else { nbttagcompound.setString("id", s); writeToNBT(nbttagcompound); return true; } }