private bool loadlevelFile() { this.path = saveTo + "/level.dat"; ; try { lreader = new NBTFileReader(path); lroot = lreader.compound; hasStrongholdEndPortal = (TagByte)lroot.getNode(@"\Data\hasStrongholdEndPortal"); hasStronghold = (TagByte)lroot.getNode(@"\Data\hasStronghold"); hardcore = (TagByte)lroot.getNode(@"\Data\hardcore"); thundering = (TagByte)lroot.getNode(@"\Data\thundering"); raining = (TagByte)lroot.getNode(@"\Data\raining"); hasBeenInCreative = (TagByte)lroot.getNode(@"\Data\hasBeenInCreative"); spawnBonusChest = (TagByte)lroot.getNode(@"\Data\spawnBonusChest"); MapFeatures = (TagByte)lroot.getNode(@"\Data\MapFeatures"); hasBeenInCreative = (TagByte)lroot.getNode(@"\Data\hasBeenInCreative"); LSpawnX = (TagInt)lroot.getNode(@"\Data\SpawnX"); LSpawnY = (TagInt)lroot.getNode(@"\Data\SpawnY"); LSpawnZ = (TagInt)lroot.getNode(@"\Data\SpawnZ"); StrongholdX = (TagInt)lroot.getNode(@"\Data\StrongholdX"); StrongholdY = (TagInt)lroot.getNode(@"\Data\StrongholdY"); StrongholdZ = (TagInt)lroot.getNode(@"\Data\StrongholdZ"); StrongholdEndPortalX = (TagInt)lroot.getNode(@"\Data\StrongholdEndPortalX"); StrongholdEndPortalZ = (TagInt)lroot.getNode(@"\Data\StrongholdEndPortalZ"); RandomSeed = (TagLong)lroot.getNode(@"\Data\RandomSeed"); LastPlayed = (TagLong)lroot.getNode(@"\Data\LastPlayed"); Time = (TagLong)lroot.getNode(@"\Data\Time"); GameType = (TagInt)lroot.getNode(@"\Data\GameType"); rainTime = (TagInt)lroot.getNode(@"\Data\rainTime"); thunderTime = (TagInt)lroot.getNode(@"\Data\thunderTime"); } catch (FailedReadException exception) { if (exception.InnerException != null) { MessageBox.Show(exception.InnerException.Message); } return false; } if (this.hasStrongholdEndPortal.ToString() == "1") { this.chkhasStrongholdEndPortal.Checked = true; } else { this.chkhasStrongholdEndPortal.Checked = false; } if (this.hasStronghold.ToString() == "1") { this.chkhasStronghold.Checked = true; } else { this.chkhasStronghold.Checked = false; } if (this.hardcore.ToString() == "1") { this.chkhardcore.Checked = true; } else { this.chkhardcore.Checked = false; } if (this.thundering.ToString() == "1") { this.chkthundering.Checked = true; } else { this.chkthundering.Checked = false; } if (this.raining.ToString() == "1") { this.chkraining.Checked = true; } else { this.chkraining.Checked = false; } if (this.hasBeenInCreative.ToString() == "1") { this.chkhasBeenInCreative.Checked = true; } else { this.chkhasBeenInCreative.Checked = false; } if (this.spawnBonusChest.ToString() == "1") { this.chkspawnBonusChest.Checked = true; } else { this.chkspawnBonusChest.Checked = false; } if (this.MapFeatures.ToString() == "1") { this.chkMapFeatures.Checked = true; } else { this.chkMapFeatures.Checked = false; } if (this.hasBeenInCreative.ToString() == "1") { this.chkhasBeenInCreative.Checked = true; } else { this.chkhasBeenInCreative.Checked = false; } this.txtLSpawnX.Text = this.LSpawnX.ToString(); this.txtLSpawnY.Text = this.LSpawnY.ToString(); this.txtLSpawnZ.Text = this.LSpawnZ.ToString(); this.txtStrongholdX.Text = this.StrongholdX.ToString(); this.txtStrongholdY.Text = this.StrongholdY.ToString(); this.txtStrongholdZ.Text = this.StrongholdZ.ToString(); this.txtStrongholdEndPortalX.Text = this.StrongholdEndPortalX.ToString(); this.txtStrongholdEndPortalZ.Text = this.StrongholdEndPortalZ.ToString(); this.txtRandomSeed.Text = this.RandomSeed.ToString(); this.txtLastPlayed.Text = this.LastPlayed.ToString(); this.txtTime.Text = this.Time.ToString(); this.txtGameType.Text = this.GameType.ToString(); this.txtrainTime.Text = this.rainTime.ToString(); this.txtthunderTime.Text = this.thunderTime.ToString(); return true; }
private bool loadplayerFile() { this.path = saveTo + "/" + domainUpDown1.Text; ; try { preader = new NBTFileReader(path); proot = preader.compound; Health = (TagShort)proot.getNode(@"\Health"); DeathTime = (TagShort)proot.getNode(@"\DeathTime"); AttackTime = (TagShort)proot.getNode(@"\AttackTime"); HurtTime = (TagShort)proot.getNode(@"\HurtTime"); PDimension = (TagInt)proot.getNode(@"\Dimension"); Sleeping = (TagByte)proot.getNode(@"\Sleeping"); invulnerable = (TagByte)proot.getNode(@"\abilities\invulnerable"); instabuild = (TagByte)proot.getNode(@"\abilities\instabuild"); flying = (TagByte)proot.getNode(@"\abilities\flying"); mayfly = (TagByte)proot.getNode(@"\abilities\mayfly"); SleepTimer = (TagShort)proot.getNode(@"\SleepTimer"); SpawnX = (TagInt)proot.getNode(@"\SpawnX"); SpawnY = (TagInt)proot.getNode(@"\SpawnY"); SpawnZ = (TagInt)proot.getNode(@"\SpawnZ"); foodLevel = (TagInt)proot.getNode(@"\foodLevel"); foodTickTimer = (TagInt)proot.getNode(@"\foodTickTimer"); foodExhaustionLevel = (TagFloat)proot.getNode(@"\foodExhaustionLevel"); foodSaturationLevel = (TagFloat)proot.getNode(@"\foodSaturationLevel"); XpP = (TagFloat)proot.getNode(@"\XpP"); XpLevel = (TagInt)proot.getNode(@"\XpLevel"); XpTotal = (TagInt)proot.getNode(@"\XpTotal"); /* this.reader = new NBTFileReader(path); this.root = this.reader.compound; if (!((((this.loadColorsArray()))))) //&& this.loadScale()) && (this.loadDimension() && this.loadWidth())) && (this.loadHeight() && this.loadXCenter())) && this.loadZCenter())) { return false; }*/ } catch (FailedReadException exception) { if (exception.InnerException != null) { MessageBox.Show(exception.InnerException.Message); } return false; } this.txtHealth.Text = this.Health.ToString(); // this.txtDeathTime.Text = this.DeathTime.ToString(); // this.txtAttackTime.Text = this.AttackTime.ToString(); // this.txtHurtTime.Text = this.HurtTime.ToString(); this.txtPDimension.Text = this.PDimension.ToString(); if (this.Sleeping.ToString() == "1") { this.chkSleeping.Checked = true; } else { this.chkSleeping.Checked = false; } if (this.instabuild.ToString() == "1") { this.chkInstabuild.Checked = true; } else { this.chkInstabuild.Checked = false; } if (this.invulnerable.ToString() == "1") { this.chkInvulnerable.Checked = true; } else { this.chkInvulnerable.Checked = false; } if (this.mayfly.ToString() == "1") { this.chkMayfly.Checked = true; } else { this.chkMayfly.Checked = false; } if (this.flying.ToString() == "1") { this.chkFlying.Checked = true; } else { this.chkFlying.Checked = false; } // this.txtSleepTimer.Text = this.SleepTimer.ToString(); this.txtSpawnX.Text = this.SpawnX.ToString(); this.txtSpawnY.Text = this.SpawnY.ToString(); this.txtSpawnZ.Text = this.SpawnZ.ToString(); this.txtFoodLevel.Text = this.foodLevel.ToString(); this.txtFoodTickTimer.Text = this.foodTickTimer.ToString(); this.txtFoodExhaustionLevel.Text = this.foodExhaustionLevel.ToString(); this.txtFoodSaturationLevel.Text = this.foodSaturationLevel.ToString(); this.txtXpP.Text = this.XpP.ToString(); this.txtXpLevel.Text = this.XpLevel.ToString(); this.txtXpTotal.Text = this.XpTotal.ToString(); return true; }