// If this comment is removed the program will blow up

import { world, system, ItemStack, EquipmentSlot } from '@minecraft/server';
import { ActionFormData } from '@minecraft/server-ui';
class FogManager {
  constructor() {
    this.activeFogPlayers = new Map();
    this.fogTypes = {
      'MOON': "jerry:moon_fog",
      'SPACE': "jerry:space_fog"
    };
  }
  ["applyMoonFog"](_0x1a50c0, _0x537ffe = "MOON") {
    try {
      this.clearPlayerFog(_0x1a50c0);
      const _0x1e49bc = this.fogTypes[_0x537ffe];
      const _0xdbe52a = "moon_atmosphere_" + _0x537ffe.toLowerCase();
      _0x1a50c0.runCommand("fog @s push " + _0x1e49bc + " " + _0xdbe52a);
      this.activeFogPlayers.set(_0x1a50c0.id, _0x537ffe);
    } catch (_0x24f3f2) {}
  }
  ["removeMoonFog"](_0x114641) {
    try {
      const _0x5ccf06 = this.activeFogPlayers.get(_0x114641.id);
      if (!_0x5ccf06) {
        return;
      }
      const _0x1242cb = 'moon_atmosphere_' + _0x5ccf06.toLowerCase();
      _0x114641.runCommand("fog @s remove " + _0x1242cb);
      this.activeFogPlayers["delete"](_0x114641.id);
    } catch (_0x145d0a) {
      this.activeFogPlayers["delete"](_0x114641.id);
    }
  }
  ["hasActiveFog"](_0x64f564) {
    return this.activeFogPlayers.has(_0x64f564.id);
  }
  ["getCurrentFogType"](_0x251d9c) {
    return this.activeFogPlayers.get(_0x251d9c.id) || null;
  }
  ["clearPlayerFog"](_0x2c5f64) {
    try {
      _0x2c5f64.runCommand("fog @s remove moon_atmosphere_moon");
      _0x2c5f64.runCommand("fog @s remove moon_atmosphere_space");
      this.activeFogPlayers["delete"](_0x2c5f64.id);
    } catch (_0x11c232) {
      this.activeFogPlayers["delete"](_0x2c5f64.id);
    }
  }
  ["updateFogBasedOnAltitude"](_0x5d1029, _0x14c063) {
    if (!this.hasActiveFog(_0x5d1029)) {
      return;
    }
    if (_0x14c063 > 0xc8) {
      if (this.getCurrentFogType(_0x5d1029) !== "SPACE") {
        this.applyMoonFog(_0x5d1029, 'SPACE');
      }
    } else if (this.getCurrentFogType(_0x5d1029) !== 'MOON') {
      this.applyMoonFog(_0x5d1029, "MOON");
    }
  }
}
class SpaceBubble {
  constructor(_0x47a05b = null) {
    this.activeBubbles = new Map();
    this.rocketSystem = _0x47a05b;
    this.updateInterval = null;
  }
  ["createBubble"](_0x396743) {
    try {
      if (this.activeBubbles.has(_0x396743.id)) {
        return this.activeBubbles.get(_0x396743.id).bubble;
      }
      const _0x2075e4 = _0x396743.location;
      const _0x231948 = _0x396743.dimension;
      const _0xd537dc = _0x231948.spawnEntity("jerry:space_bubble", {
        'x': _0x2075e4.x,
        'y': _0x2075e4.y + 0x6,
        'z': _0x2075e4.z
      });
      if (!_0xd537dc) {
        return null;
      }
      const _0x13da72 = {
        'bubble': _0xd537dc,
        'rocket': _0x396743,
        'stage': 0x0,
        'stageTimer': 0x0,
        'created': Date.now(),
        'hasStartedProgression': false,
        'teleportInitiated': false,
        'teleportTimer': 0x0
      };
      this.activeBubbles.set(_0x396743.id, _0x13da72);
      return _0xd537dc;
    } catch (_0x5c2644) {
      return null;
    }
  }
  ["updateBubbles"]() {
    for (const [_0x3f484f, _0x3879d1] of this.activeBubbles) {
      try {
        const {
          bubble: _0xacbf21,
          rocket: _0x31408f,
          stage: _0x45f12f,
          stageTimer: _0x5e1c98,
          hasStartedProgression: _0x35e174
        } = _0x3879d1;
        if (!_0xacbf21 || !_0x31408f) {
          this.activeBubbles["delete"](_0x3f484f);
          continue;
        }
        let _0x48c6cb = null;
        try {
          const _0x517d0d = _0x31408f.getComponent("rideable");
          if (_0x517d0d && _0x517d0d.getRiders().length > 0x0) {
            _0x48c6cb = _0x517d0d.getRiders()[0x0];
          }
        } catch (_0x3dcb5f) {}
        const _0x191171 = _0x31408f.location;
        _0xacbf21.teleport({
          'x': _0x191171.x,
          'y': _0x191171.y + 0x6,
          'z': _0x191171.z
        });
        if (!_0x35e174 && _0x191171.y >= 0x190) {
          _0x3879d1.hasStartedProgression = true;
          _0x3879d1.stageTimer = 0x0;
          this.setStage(_0xacbf21, 0x1);
          _0x3879d1.stage = 0x1;
        } else if (!_0x35e174) {
          _0x3879d1.stageTimer++;
        }
        if (_0x35e174 && _0x191171.y >= 0x190) {
          _0x3879d1.stageTimer++;
          const _0x19eaa5 = Math.min(Math.floor(_0x3879d1.stageTimer / 0x96) + 0x1, 0x4);
          if (_0x19eaa5 !== _0x3879d1.stage && _0x19eaa5 <= 0x4) {
            this.setStage(_0xacbf21, _0x19eaa5);
            _0x3879d1.stage = _0x19eaa5;
          }
          if (_0x3879d1.stage === 0x4 && !_0x3879d1.teleportInitiated) {
            _0x3879d1.teleportTimer++;
            if (_0x3879d1.teleportTimer % 0x14 === 0x0 && _0x48c6cb && _0x48c6cb.isValid()) {}
            if (_0x3879d1.teleportTimer >= 0x64) {
              if (this.rocketSystem) {
                this.rocketSystem.teleportToSpace(_0x31408f, _0x3f484f, _0x48c6cb);
              }
              _0x3879d1.teleportInitiated = true;
            }
          }
        }
      } catch (_0x712f93) {
        this.activeBubbles["delete"](_0x3f484f);
      }
    }
  }
  ["setStage"](_0x1d208f, _0x9200e0) {
    try {
      switch (_0x9200e0) {
        case 0x1:
          _0x1d208f.triggerEvent("jerry:set_stage1");
          break;
        case 0x2:
          _0x1d208f.triggerEvent("jerry:set_stage2");
          break;
        case 0x3:
          _0x1d208f.triggerEvent("jerry:set_stage3");
          break;
        case 0x4:
          _0x1d208f.triggerEvent('jerry:set_stage4');
          break;
      }
    } catch (_0x19a7a6) {}
  }
  ["removeBubble"](_0x4d9639) {
    try {
      const _0x4427ed = this.activeBubbles.get(_0x4d9639);
      if (_0x4427ed && _0x4427ed.bubble) {
        _0x4427ed.bubble.kill();
      }
      this.activeBubbles["delete"](_0x4d9639);
    } catch (_0x1bc511) {}
  }
  ['getBubble'](_0x2f798f) {
    return this.activeBubbles.get(_0x2f798f) || null;
  }
  ['initialize']() {
    if (this.updateInterval) {
      system.clearRun(this.updateInterval);
    }
    this.updateInterval = system.runInterval(() => {
      this.updateBubbles();
    }, 0x1);
  }
}
class ChunkGenerator {
  constructor() {
    this.structures = ["chunk1", "chunk2", 'chunk3', "chunk4", "chunk5", "chunk6", "chunk7", "chunk8", "chunk9", "chunk10", "chunk11", 'chunk12', "chunk13", "chunk14", 'chunk15', "chunk16", "chunk17", "chunk18", "chunk19", "chunk20", "chunk21", "chunk22", 'chunk23', 'chunk24'];
    this.originPoint = {
      'x': 0x4e20,
      'y': 0xc8,
      'z': 0x4e20
    };
    this.chunkSpacing = 0x10;
    this.minDistanceFromEndOrigin = 0x3a98;
    this.generatedChunks = new Set();
    this.lastPlayerPositions = new Map();
    this.rotations = [0x0, 0x5a, 0xb4, 0x10e];
    this.CHUNKS_PROPERTY_KEY = 'spaceExploration:generatedChunks';
    this.saveTimer = null;
    this.needsSave = false;
  }
  ['loadGeneratedChunks']() {
    try {
      if (typeof world.getDynamicProperty === "function") {
        const _0x37d9a5 = world.getDynamicProperty(this.CHUNKS_PROPERTY_KEY);
        if (_0x37d9a5 && typeof _0x37d9a5 === 'string') {
          const _0x4db3c6 = JSON.parse(_0x37d9a5);
          this.generatedChunks = new Set(_0x4db3c6);
        } else {
          this.generatedChunks = new Set();
        }
      } else {
        this.generatedChunks = new Set();
      }
    } catch (_0x3aca4c) {
      this.generatedChunks = new Set();
    }
  }
  ['saveGeneratedChunks']() {
    try {
      const _0x57f90b = Array.from(this.generatedChunks);
      const _0x2d4d2c = JSON.stringify(_0x57f90b);
      if (typeof world.setDynamicProperty === 'function') {
        world.setDynamicProperty(this.CHUNKS_PROPERTY_KEY, _0x2d4d2c);
      } else {}
    } catch (_0x159159) {}
  }
  ["scheduleSave"]() {
    this.needsSave = true;
    if (this.saveTimer) {
      system.clearRun(this.saveTimer);
    }
    this.saveTimer = system.runTimeout(() => {
      if (this.needsSave) {
        this.saveGeneratedChunks();
        this.needsSave = false;
      }
    }, 0x64);
  }
  ["isValidChunkPosition"](_0x510b43, _0x11fc9c) {
    const _0x215fa2 = Math.sqrt(_0x510b43 * _0x510b43 + _0x11fc9c * _0x11fc9c);
    return _0x215fa2 >= this.minDistanceFromEndOrigin;
  }
  ["spawnRandomChunk"](_0xf7c88e, _0x2365c0, _0x462980, _0x1ebdd3) {
    const _0x1c7ecf = _0x2365c0 + '_' + _0x1ebdd3;
    if (this.generatedChunks.has(_0x1c7ecf)) {
      return false;
    }
    try {
      const _0xc5eefb = this.structures[Math.floor(Math.random() * this.structures.length)];
      const _0x30067a = this.rotations[Math.floor(Math.random() * this.rotations.length)];
      const _0x23374a = "structure load " + _0xc5eefb + " " + _0x2365c0 + " " + _0x462980 + " " + _0x1ebdd3 + " " + _0x30067a + "_degrees";
      _0xf7c88e.runCommand(_0x23374a);
      this.generatedChunks.add(_0x1c7ecf);
      this.scheduleSave();
      return true;
    } catch (_0x96e059) {
      this.generatedChunks["delete"](_0x1c7ecf);
      this.scheduleSave();
      return false;
    }
  }
  ["generateChunksAroundPlayer"](_0x28ac0c) {
    if (_0x28ac0c.dimension.id !== 'minecraft:the_end') {
      return;
    }
    const _0x44f368 = _0x28ac0c.location;
    const _0x19c506 = Math.floor(_0x44f368.x / this.chunkSpacing) * this.chunkSpacing;
    const _0x5c4877 = Math.floor(_0x44f368.z / this.chunkSpacing) * this.chunkSpacing;
    let _0x3cdd50 = 0x0;
    for (let _0x47847b = -0x6; _0x47847b <= 0x6; _0x47847b++) {
      for (let _0x42f238 = -0x6; _0x42f238 <= 0x6; _0x42f238++) {
        const _0x30dbd3 = _0x19c506 + _0x47847b * this.chunkSpacing;
        const _0x1ae765 = _0x5c4877 + _0x42f238 * this.chunkSpacing;
        const _0x2166f4 = _0x30dbd3 + '_' + _0x1ae765;
        if (this.generatedChunks.has(_0x2166f4)) {
          continue;
        }
        const _0x42cc65 = Math.sqrt(_0x30dbd3 * _0x30dbd3 + _0x1ae765 * _0x1ae765);
        if (_0x42cc65 < this.minDistanceFromEndOrigin) {
          continue;
        }
        const _0x47d269 = this.spawnRandomChunk(_0x28ac0c.dimension, _0x30dbd3, this.originPoint.y, _0x1ae765);
        if (_0x47d269) {
          _0x3cdd50++;
        }
      }
    }
    if (_0x3cdd50 > 0x0) {}
  }
  ['initialize']() {
    this.loadGeneratedChunks();
    for (const _0xe04241 of world.getPlayers()) {
      if (_0xe04241.dimension.id === "minecraft:the_end") {
        this.generateChunksAroundPlayer(_0xe04241);
      }
    }
  }
}
class Rocket {
  constructor(_0x201098) {
    this.spaceBubble = _0x201098;
    this.fogManager = new FogManager();
    this.flyingRockets = new Map();
    this.originalLocations = new Map();
    this.activeUIs = new Set();
    this.shownUIs = new Set();
    this.rocketOwners = new Map();
    this.usedRockets = new Set();
    this.starSpawnInterval = null;
    this.moonStarInterval = null;
    this.earthParticleInterval = null;
    this.flightPhysicsInterval = null;
    this.hasSetGameRules = false;
    this.spaceSuitInterval = null;
    this.moonFogInterval = null;
    this.playerSuffocationStates = new Map();
    this.earthParticleLocations = [];
  }
  ["initialize"]() {
    this.setupOneTimeGameRules();
    this.loadPersistentData();
    this.setupRocketDeathHandling();
    this.setupFlightPhysics();
    this.setupPlayerInputHandling();
    this.setupStarParticles();
    this.setupSpaceSuitMonitoring();
    this.setupMoonFogMonitoring();
    this.setupGuidebookSystem();
    this.setupPeriodicSave();
  }
  ['loadPersistentData']() {
    try {
      const _0x9c5274 = world.getDynamicProperty("rocket_owners");
      if (_0x9c5274) {
        const _0x5d7970 = JSON.parse(_0x9c5274);
        this.rocketOwners = new Map(Object.entries(_0x5d7970));
      }
      const _0x5c17a9 = world.getDynamicProperty("original_locations");
      if (_0x5c17a9) {
        const _0x25a8f6 = JSON.parse(_0x5c17a9);
        this.originalLocations = new Map(Object.entries(_0x25a8f6));
        for (const [_0x11646e, _0x31e7a9] of this.originalLocations) {
          if (Math.abs(_0x31e7a9.location.x) > 0x2710 || Math.abs(_0x31e7a9.location.z) > 0x2710 || _0x31e7a9.location.y > 0x96) {}
        }
      }
      const _0x536545 = world.getDynamicProperty("used_rockets");
      if (_0x536545) {
        const _0x18e781 = JSON.parse(_0x536545);
        this.usedRockets = new Set(_0x18e781);
      }
    } catch (_0x1b5235) {
      this.rocketOwners = new Map();
      this.originalLocations = new Map();
      this.usedRockets = new Set();
    }
  }
  ["savePersistentData"]() {
    try {
      const _0x100283 = Object.fromEntries(this.rocketOwners);
      world.setDynamicProperty("rocket_owners", JSON.stringify(_0x100283));
      const _0x3fd4e0 = Object.fromEntries(this.originalLocations);
      world.setDynamicProperty("original_locations", JSON.stringify(_0x3fd4e0));
      const _0x4e4c75 = Array.from(this.usedRockets);
      world.setDynamicProperty("used_rockets", JSON.stringify(_0x4e4c75));
    } catch (_0x1f96b8) {}
  }
  ['setupPeriodicSave']() {
    system.runInterval(() => {
      this.savePersistentData();
    }, 0x258);
  }
  ['setupOneTimeGameRules']() {
    try {
      const _0x3b7e28 = world.getDynamicProperty('fly_to_moon_gamerules_set');
      if (!_0x3b7e28) {
        const _0x4657a4 = world.getDimension('minecraft:overworld');
        _0x4657a4.runCommand("gamerule commandblockoutput false");
        world.setDynamicProperty("fly_to_moon_gamerules_set", true);
      } else {}
    } catch (_0x7f95ff) {}
  }
  ["setupStarParticles"]() {
    if (this.starSpawnInterval) {
      system.clearRun(this.starSpawnInterval);
    }
    if (this.moonStarInterval) {
      system.clearRun(this.moonStarInterval);
    }
    if (this.earthParticleInterval) {
      system.clearRun(this.earthParticleInterval);
    }
    this.starSpawnInterval = system.runInterval(() => {
      this.spawnStarsAroundRockets();
    }, 0x64);
    this.moonStarInterval = system.runInterval(() => {
      this.spawnStarsInMoonSky();
    }, 0x64);
    this.earthParticleInterval = system.runInterval(() => {
      this.spawnEarthParticlesAbovePlayers();
    }, 0x190);
  }
  ["spawnStarsAroundRockets"]() {
    try {
      for (const [_0x13fe43, _0xa657d1] of this.flyingRockets) {
        if (_0xa657d1.isFlying && _0xa657d1.rocket && _0xa657d1.rocket.isValid()) {
          const _0x24a085 = _0xa657d1.rocket;
          const _0x5a6d5e = _0x24a085.location;
          const _0x3df7f3 = _0x24a085.dimension;
          const _0x21e159 = Math.floor(Math.random() * 0x10) + 0x19;
          for (let _0x4edcdf = 0x0; _0x4edcdf < _0x21e159; _0x4edcdf++) {
            const _0x3e4fd0 = Math.random() * 0x2 * Math.PI;
            const _0x3f6c1b = 0xf + Math.random() * 0x32;
            const _0x45d733 = 0x8 + Math.random() * 0xa;
            const _0x558d7d = {
              'x': _0x5a6d5e.x + Math.cos(_0x3e4fd0) * _0x3f6c1b,
              'y': _0x5a6d5e.y + _0x45d733,
              'z': _0x5a6d5e.z + Math.sin(_0x3e4fd0) * _0x3f6c1b
            };
            _0x3df7f3.spawnParticle("jerry:star_particle", _0x558d7d);
          }
        }
      }
    } catch (_0x1bd62b) {}
  }
  ['spawnStarsInMoonSky']() {
    try {
      const _0x244290 = world.getDimension("minecraft:the_end");
      const _0x216534 = world.getPlayers();
      for (const _0x4e8922 of _0x216534) {
        if (_0x4e8922.dimension.id === 'minecraft:the_end') {
          const _0x4c8e12 = _0x4e8922.location;
          const _0x250be1 = Math.floor(Math.random() * 0x1f) + 0x28;
          for (let _0x238186 = 0x0; _0x238186 < _0x250be1; _0x238186++) {
            const _0x3df296 = {
              'x': _0x4c8e12.x + (Math.random() - 0.5) * 0xa0,
              'y': _0x4c8e12.y + 0xd + Math.random() * 0xf,
              'z': _0x4c8e12.z + (Math.random() - 0.5) * 0xa0
            };
            _0x244290.spawnParticle("jerry:star_particle", _0x3df296);
          }
        }
      }
    } catch (_0x4caad8) {}
  }
  ['spawnEarthParticlesAbovePlayers']() {
    try {
      const _0x3ec422 = world.getPlayers();
      for (const _0x73987b of _0x3ec422) {
        if (_0x73987b.dimension.id === "minecraft:the_end") {
          const _0x287207 = _0x73987b.location;
          const _0x178afd = _0x73987b.dimension;
          const _0x2dadd1 = {
            'x': _0x287207.x + (Math.random() - 0.5) * 0xa,
            'y': _0x287207.y + 0x28 + Math.random() * 0xa,
            'z': _0x287207.z + (Math.random() - 0.5) * 0xa
          };
          let _0x419069 = false;
          for (const _0x31e6e0 of this.earthParticleLocations) {
            const _0x1614a9 = Math.sqrt(Math.pow(_0x2dadd1.x - _0x31e6e0.x, 0x2) + Math.pow(_0x2dadd1.y - _0x31e6e0.y, 0x2) + Math.pow(_0x2dadd1.z - _0x31e6e0.z, 0x2));
            if (_0x1614a9 < 0x32) {
              _0x419069 = true;
              break;
            }
          }
          if (!_0x419069) {
            _0x178afd.spawnParticle("jerry:earth_particle", _0x2dadd1);
            this.earthParticleLocations.push(_0x2dadd1);
            system.runTimeout(() => {
              const _0xcd9725 = this.earthParticleLocations.indexOf(_0x2dadd1);
              if (_0xcd9725 > -0x1) {
                this.earthParticleLocations.splice(_0xcd9725, 0x1);
              }
            }, 0x258);
          }
        } else {}
      }
    } catch (_0x92c642) {}
  }
  ["setupSpaceSuitMonitoring"]() {
    if (this.spaceSuitInterval) {
      system.clearRun(this.spaceSuitInterval);
    }
    this.spaceSuitInterval = system.runInterval(() => {
      this.checkSpaceSuitRequirements();
    }, 0x14);
  }
  ["setupMoonFogMonitoring"]() {
    if (this.moonFogInterval) {
      system.clearRun(this.moonFogInterval);
    }
    this.moonFogInterval = system.runInterval(() => {
      this.checkAndApplyMoonFog();
    }, 0x14);
  }
  ["checkAndApplyMoonFog"]() {
    try {
      const _0x4805af = world.getPlayers();
      const _0x36cb18 = world.getDimension("minecraft:the_end");
      const _0x16648c = _0x36cb18.getEntities({
        'type': 'minecraft:enderman',
        'location': {
          'x': 0x4e20,
          'y': 0x80,
          'z': 0x4e20
        },
        'maxDistance': 0x1388
      });
      for (const _0x453abc of _0x16648c) {
        _0x453abc.remove();
      }
      const _0x487d42 = _0x36cb18.getEntities({
        'type': "jerry:lunar_phantom",
        'location': {
          'x': 0x0,
          'y': 0x80,
          'z': 0x0
        },
        'maxDistance': 0x2710
      });
      const _0x394107 = _0x36cb18.getEntities({
        'type': "jerry:necronaut",
        'location': {
          'x': 0x0,
          'y': 0x80,
          'z': 0x0
        },
        'maxDistance': 0x2710
      });
      for (const _0x979449 of _0x487d42) {
        _0x979449.remove();
      }
      for (const _0x535e46 of _0x394107) {
        _0x535e46.remove();
      }
      for (const _0x12aa8e of _0x4805af) {
        if (_0x12aa8e.dimension.id === "minecraft:the_end") {
          const _0x21d59c = _0x12aa8e.location;
          const _0x3fdb2a = _0x21d59c.x - 0x4e20;
          const _0x506f7a = _0x21d59c.z - 0x4e20;
          const _0x1ef4a1 = Math.sqrt(_0x3fdb2a * _0x3fdb2a + _0x506f7a * _0x506f7a);
          if (_0x1ef4a1 <= 0x1388) {
            const _0x111f9a = this.fogManager.getCurrentFogType(_0x12aa8e);
            if (!_0x111f9a || _0x111f9a !== "SPACE") {
              this.fogManager.applyMoonFog(_0x12aa8e, "SPACE");
            }
          } else {
            const _0x45d64e = this.fogManager.getCurrentFogType(_0x12aa8e);
            if (_0x45d64e === "MOON" || _0x45d64e === "SPACE") {
              this.fogManager.removeMoonFog(_0x12aa8e);
            }
          }
        } else {
          if (_0x12aa8e.dimension.id === "minecraft:overworld") {
            const _0x585107 = this.fogManager.getCurrentFogType(_0x12aa8e);
            if (_0x585107 === "MOON" || _0x585107 === "SPACE") {
              this.fogManager.removeMoonFog(_0x12aa8e);
            }
          }
        }
      }
    } catch (_0x148339) {}
  }
  ["setupGuidebookSystem"]() {
    system.run(() => {
      this.checkForNewPlayers();
    });
    system.runInterval(() => {
      this.checkForNewPlayers();
    }, 0x28);
    world.beforeEvents.itemUse.subscribe(_0x2ed965 => {
      if (_0x2ed965.itemStack.typeId === "jerry:fmttm_guidebook") {
        _0x2ed965.cancel = true;
        system.run(() => {
          this.showGuidebookUI(_0x2ed965.source);
        });
      }
    });
    system.runInterval(() => {
      this.checkForNewPlayers();
    }, 0x258);
  }
  ["checkForNewPlayers"]() {
    try {
      const _0x7b8357 = world.getPlayers();
      for (const _0x1d12bf of _0x7b8357) {
        if (!_0x1d12bf.hasTag("fmttmwelcome")) {
          this.giveGuidebookToPlayer(_0x1d12bf);
          _0x1d12bf.addTag("fmttmwelcome");
        }
      }
    } catch (_0x132706) {}
  }
  ["giveGuidebookToPlayer"](_0xe441cb) {
    try {
      const _0x16fa81 = new ItemStack('jerry:fmttm_guidebook', 0x1);
      _0xe441cb.getComponent("inventory").container.addItem(_0x16fa81);
      _0xe441cb.sendMessage("§6Thanks for installing Fly Me to the Moon (FMTTM) §eCheck your inventory for the guidebook!! - Jerry");
    } catch (_0x397904) {}
  }
  ["showGuidebookUI"](_0x4b3660) {
    try {
      const _0x1bf5d9 = new ActionFormData().title("FMTTM Guidebook").body("This addon is about exploring planets, well... for now only the moon.\n\nSelect a topic:").button("§9Join the Discord!").button("Launch Pad").button('Rocket').button("Space Suits").button("The Moon").button("Moon Rock").button("Moon Mobs").button('Peridot').button("New Music Disc");
      _0x1bf5d9.show(_0x4b3660).then(_0x166545 => {
        if (_0x166545.canceled) {
          return;
        }
        switch (_0x166545.selection) {
          case 0x0:
            this.showGuidebookPage(_0x4b3660, "§9Join the Discord!", "Connect with other players and get updates!\n\ndiscord.gg/P3ahdUzgMH\n\nWe would love to see you join!");
            break;
          case 0x1:
            this.showGuidebookPage(_0x4b3660, "Launch Pad", "The foundation for your lunar journey..\n\nCrafted with:\n• Copper blocks\n• Obsidian\n• Iron ingots\n\nPlace this down and put your rocket on top.");
            break;
          case 0x2:
            this.showGuidebookPage(_0x4b3660, 'Rocket', "Your ticket to the moon!\n\nCrafted with:\n• Redstone block\n• Iron blocks\n• Dispensers\n\nRight-click to ride and launch, just make sure to make a spacesuit first!!!");
            break;
          case 0x3:
            this.showGuidebookPage(_0x4b3660, "Space Suits", "Essential for surviving in space.\n\nRequired: Helmet + Chestplate\nUpgrade any armor (except leather/chainmail) by surrounding with ore type in crafting table.\n\nWARNING: You will suffocate on the moon without a suit");
            break;
          case 0x4:
            this.showGuidebookPage(_0x4b3660, "The Moon", "A new dimension to explore!\n\nFeatures:\n• Low gravity\n• Low visibility\n• Abundant iron and amethyst\n• New blocks to discover");
            break;
          case 0x5:
            this.showGuidebookPage(_0x4b3660, "Moon Rock", "Unique material\n\nFound only on the moon.\nCan be crafted into Moon Stone Bricks for building.\n\nUse 4 Moon Rock in a 2x2 pattern to craft Moon Stone Bricks.");
            break;
          case 0x6:
            this.showGuidebookPage(_0x4b3660, "Mobs", "Necronauts are a zombie-like undead spaceman that appear on the moon, basically moon zombies. Lunar Phantoms are basically the same idea but drop a new rare gem called peridot");
            break;
          case 0x7:
            this.showGuidebookPage(_0x4b3660, "Peridot", "Peridot is a new gem that can be mined or dropped by lunar phantoms. It can be crafted the potion of the moonwalker, which grants 3 minutes of moon gravity. Peridot will eventually be used to craft items to go to further out planets.");
            break;
          case 0x8:
            this.showGuidebookPage(_0x4b3660, "New Music Disc", "I'll let you figure this one out\n\nPerfect for setting the mood during your moon adventure");
            break;
        }
      });
    } catch (_0x49e9c7) {}
  }
  ["showGuidebookPage"](_0xd1c43, _0x2315e6, _0x404d57) {
    try {
      const _0x5440d6 = new ActionFormData().title(_0x2315e6).body(_0x404d57).button("Back");
      _0x5440d6.show(_0xd1c43).then(_0x2e1f92 => {
        if (!_0x2e1f92.canceled && _0x2e1f92.selection === 0x0) {
          this.showGuidebookUI(_0xd1c43);
        }
      });
    } catch (_0x50f18d) {}
  }
  ["checkSpaceSuitRequirements"]() {
    try {
      const _0x43f0ef = world.getPlayers();
      for (const _0x109467 of _0x43f0ef) {
        if (_0x109467.dimension.id === "minecraft:the_end") {
          const _0x435e7a = this.hasCompleteSpaceSuit(_0x109467);
          if (!_0x435e7a) {
            this.updatePlayerSuffocation(_0x109467, true);
          } else {
            this.updatePlayerSuffocation(_0x109467, false);
          }
        }
      }
    } catch (_0x499f30) {}
  }
  ["updatePlayerSuffocation"](_0x341351, _0x5c0158) {
    try {
      const _0x1d469a = _0x341351.id;
      if (_0x5c0158) {
        if (!this.playerSuffocationStates.has(_0x1d469a)) {
          this.playerSuffocationStates.set(_0x1d469a, {
            'airTime': 0xc8,
            'lastDamageTime': 0x0
          });
        }
        const _0x2446fa = this.playerSuffocationStates.get(_0x1d469a);
        _0x2446fa.airTime -= 0x14;
        if (_0x2446fa.airTime <= 0x0) {
          const _0x155943 = Date.now();
          if (_0x155943 - _0x2446fa.lastDamageTime >= 0x7d0) {
            _0x341351.runCommand("damage @s 1 drowning");
            _0x2446fa.lastDamageTime = _0x155943;
            this.spawnSuffocationBubbles(_0x341351, true);
          } else {
            this.spawnSuffocationBubbles(_0x341351, false);
          }
        } else if (Math.random() < 0.6) {
          this.spawnSuffocationBubbles(_0x341351, false);
        }
      } else if (this.playerSuffocationStates.has(_0x1d469a)) {
        this.playerSuffocationStates["delete"](_0x1d469a);
      }
    } catch (_0x23e629) {}
  }
  ["spawnSuffocationBubbles"](_0x29e99a, _0x41724e) {
    try {
      const _0x27f653 = _0x29e99a.location;
      const _0x16421b = _0x41724e ? 0x3 : 0x1;
      for (let _0x3e1a56 = 0x0; _0x3e1a56 < _0x16421b; _0x3e1a56++) {
        const _0x3c9eb5 = {
          'x': _0x27f653.x + (Math.random() - 0.5) * 0.8,
          'y': _0x27f653.y + 1.4 + Math.random() * 0.4,
          'z': _0x27f653.z + (Math.random() - 0.5) * 0.8
        };
        _0x29e99a.dimension.spawnParticle("minecraft:water_bubble_particle", _0x3c9eb5);
      }
    } catch (_0x4115b7) {}
  }
  ['hasCompleteSpaceSuit'](_0x271feb) {
    try {
      const _0x22f070 = _0x271feb.getComponent('minecraft:equippable');
      if (!_0x22f070) {
        return false;
      }
      const _0x18fa72 = _0x22f070.getEquipment('Head');
      const _0x555d86 = _0x22f070.getEquipment("Chest");
      const _0x2f943d = _0x22f070.getEquipment("Legs");
      const _0x4ba778 = _0x22f070.getEquipment("Feet");
      const _0x32b644 = _0x18fa72 && _0x18fa72.typeId && (_0x18fa72.typeId.includes('space_helmet') || _0x18fa72.typeId === 'jerry:copper_space_helmet' || _0x18fa72.typeId === 'jerry:iron_space_helmet' || _0x18fa72.typeId === 'jerry:golden_space_helmet' || _0x18fa72.typeId === 'jerry:diamond_space_helmet' || _0x18fa72.typeId === "jerry:netherite_space_helmet");
      const _0x47b5ef = _0x555d86 && _0x555d86.typeId && (_0x555d86.typeId.includes('space_chestplate') || _0x555d86.typeId === 'jerry:copper_space_chestplate' || _0x555d86.typeId === 'jerry:iron_space_chestplate' || _0x555d86.typeId === "jerry:golden_space_chestplate" || _0x555d86.typeId === "jerry:diamond_space_chestplate" || _0x555d86.typeId === "jerry:netherite_space_chestplate");
      const _0x1d286d = _0x2f943d && _0x2f943d.typeId && _0x2f943d.typeId !== "minecraft:air";
      const _0x5347a7 = _0x4ba778 && _0x4ba778.typeId && _0x4ba778.typeId !== 'minecraft:air';
      const _0x268d8f = _0x1d286d || _0x5347a7;
      return _0x32b644 && _0x47b5ef && _0x268d8f;
    } catch (_0x298831) {
      return false;
    }
  }
  ["setupRocketDeathHandling"]() {
    world.afterEvents.entityDie.subscribe(_0x37906e => {
      const _0x2fb448 = _0x37906e.deadEntity;
      if (_0x2fb448.typeId === 'jerry:rocket') {
        let _0x12af7c = false;
        for (const [_0x1f690f, _0x46282c] of this.flyingRockets) {
          if (_0x46282c.rocket.id === _0x2fb448.id) {
            this.explodeRocket(_0x2fb448, _0x46282c.player);
            _0x12af7c = true;
            break;
          }
        }
        if (!_0x12af7c) {}
      }
    });
  }
  ['setupFlightPhysics']() {
    if (this.flightPhysicsInterval) {
      system.clearRun(this.flightPhysicsInterval);
    }
    this.flightPhysicsInterval = system.runInterval(() => {
      for (const [_0x28a564, _0x5a331c] of this.flyingRockets) {
        this.updateRocketMovement(_0x5a331c);
        this.handleRocketSteering(_0x5a331c.player, _0x5a331c.rocket);
      }
    }, 0x1);
  }
  ["setupPlayerInputHandling"]() {}
  ["teleportToSpace"](_0x46c57d, _0x241e26, _0x30eb7e = null) {
    try {
      if (this.usedRockets.has(_0x241e26)) {
        return;
      }
      try {
        const _0x543abe = world.getPlayers();
        if (_0x543abe.length > 0x0) {}
      } catch (_0x135014) {}
      if (!_0x46c57d || !_0x46c57d.isValid()) {
        return;
      }
      try {
        this.usedRockets.add(_0x241e26);
        this.savePersistentData();
      } catch (_0x46a58a) {}
      try {
        if (this.flyingRockets.has(_0x241e26)) {
          const _0x360722 = this.flyingRockets.get(_0x241e26);
          if (_0x360722 && _0x46c57d && _0x46c57d.isValid()) {
            this.stopRocketEngineSound(_0x46c57d, _0x360722);
          }
          this.flyingRockets["delete"](_0x241e26);
        }
      } catch (_0x130bd2) {}
      let _0x5d8162;
      try {
        _0x5d8162 = world.getDimension('minecraft:the_end');
      } catch (_0xcf200d) {
        return;
      }
      const _0x3cbe34 = {
        'x': 0x4e20 + (Math.random() - 0.5) * 0x64,
        'y': 0xcd,
        'z': 0x4e20 + (Math.random() - 0.5) * 0x64
      };
      if (!_0x30eb7e || !_0x30eb7e.isValid()) {
        try {
          const _0x3bf058 = _0x46c57d.getComponent("rideable");
          if (_0x3bf058) {
            const _0x318db5 = _0x3bf058.getRiders();
            if (_0x318db5 && _0x318db5.length > 0x0) {
              _0x30eb7e = _0x318db5[0x0];
              if (_0x30eb7e && _0x30eb7e.isValid()) {} else {
                _0x30eb7e = null;
              }
            } else {}
          } else {}
        } catch (_0x20579c) {}
      } else {}
      if (_0x30eb7e && _0x30eb7e.isValid()) {
        _0x30eb7e.teleport(_0x3cbe34, {
          'dimension': _0x5d8162,
          'keepVelocity': false
        });
      } else {
        return;
      }
      system.runTimeout(() => {
        try {
          let _0x173fb5 = null;
          const _0x16e60e = this.rocketOwners.get(_0x46c57d.id);
          try {
            const _0x4566e4 = _0x5d8162.getBlock(_0x3cbe34);
            if (_0x4566e4) {
              _0x173fb5 = _0x5d8162.spawnEntity("jerry:rocket", _0x3cbe34);
            } else {
              throw new Error("Chunk not loaded - block test failed");
            }
          } catch (_0x219af9) {
            try {
              const _0x4fc4a0 = {
                'x': _0x3cbe34.x + 0xa,
                'y': 0xcd,
                'z': _0x3cbe34.z + 0xa
              };
              _0x173fb5 = _0x5d8162.spawnEntity("jerry:rocket", _0x4fc4a0);
            } catch (_0x6e3f60) {}
          }
          if (_0x173fb5 && _0x173fb5.isValid() && _0x16e60e) {
            this.rocketOwners.set(_0x173fb5.id, _0x16e60e);
            this.savePersistentData();
          }
          system.runTimeout(() => {
            try {
              if (_0x30eb7e && _0x30eb7e.isValid() && _0x30eb7e.dimension.id === "minecraft:the_end") {
                this.fogManager.applyMoonFog(_0x30eb7e, "MOON");
              }
            } catch (_0x4bf500) {}
          }, 0x3c);
          system.runTimeout(() => {
            try {
              if (_0x46c57d.isValid()) {
                this.rocketOwners['delete'](_0x46c57d.id);
                _0x46c57d.kill();
                this.savePersistentData();
              }
            } catch (_0x1cbdd2) {}
          }, 0x5);
          system.runTimeout(() => {
            try {
              if (_0x173fb5 && _0x173fb5.isValid()) {
                _0x173fb5.triggerEvent("jerry:stop_flying");
                try {
                  _0x173fb5.runCommand("effect @s slow_falling 60 0");
                } catch (_0xcf2c73) {}
              } else {}
              if (_0x30eb7e && _0x30eb7e.isValid()) {
                try {
                  _0x30eb7e.runCommand("effect @s slow_falling 30 0");
                } catch (_0x14b388) {}
                try {
                  if (_0x30eb7e && _0x30eb7e.isValid()) {
                    this.fogManager.applyMoonFog(_0x30eb7e, "MOON");
                  }
                } catch (_0x5df629) {}
                try {
                  system.runTimeout(() => {
                    if (_0x30eb7e && _0x30eb7e.isValid() && _0x30eb7e.dimension.id === "minecraft:the_end") {
                      this.fogManager.applyMoonFog(_0x30eb7e, "MOON");
                    }
                  }, 0x28);
                } catch (_0x458458) {}
              }
              system.runTimeout(() => {
                this.spaceBubble.removeBubble(_0x241e26);
              }, 0x14);
            } catch (_0x5d26b9) {}
          }, 0x14);
        } catch (_0x5ef5fe) {}
      }, 0x3c);
    } catch (_0xf65288) {
      try {
        const _0x192860 = world.getPlayers();
        if (_0x192860.length > 0x0) {}
      } catch (_0x230857) {}
    }
  }
  ["hasShownUI"](_0x64ec22) {
    return this.shownUIs.has(_0x64ec22);
  }
  ["clearPlayerUIStates"](_0x5d3dfb) {
    this.activeUIs["delete"](_0x5d3dfb);
    for (const _0x1c316c of this.shownUIs) {
      if (_0x1c316c.startsWith(_0x5d3dfb + '_')) {
        this.shownUIs["delete"](_0x1c316c);
      }
    }
  }
  ["onPlayerEnterRocket"](_0x426fc6, _0x45acb9, _0x6c22d3 = null) {
    if (!_0x426fc6 || _0x426fc6.typeId !== "minecraft:player") {
      return;
    }
    if (this.activeUIs.has(_0x426fc6.id)) {
      return;
    }
    if (_0x45acb9 && this.flyingRockets.has(_0x45acb9.id)) {
      return;
    }
    const _0x318ef5 = this.rocketOwners.get(_0x45acb9.id);
    if (_0x318ef5) {
      if (_0x318ef5 !== _0x426fc6.name) {
        try {
          _0x426fc6.runCommand("ride @s stop_riding");
        } catch (_0x48b1b6) {}
        return;
      }
    } else {
      this.rocketOwners.set(_0x45acb9.id, _0x426fc6.name);
      this.savePersistentData();
    }
    if (_0x6c22d3) {
      if (this.shownUIs.has(_0x6c22d3)) {
        return;
      }
      this.shownUIs.add(_0x6c22d3);
    }
    this.showPlanetSelectionUI(_0x426fc6);
  }
  async ["showPlanetSelectionUI"](_0x41b5e4) {
    this.activeUIs.add(_0x41b5e4.id);
    try {
      const _0x263377 = new ActionFormData().title("Rocket Navigation System").body("Select a Planet to Travel to:");
      if (_0x41b5e4.dimension.id === "minecraft:the_end") {
        _0x263377.button("Earth", 'textures/ui/worldsIcon');
      } else {
        _0x263377.button("Moon", 'textures/ui/moonicon');
      }
      const _0x10bb77 = await _0x263377.show(_0x41b5e4);
      if (_0x10bb77.canceled) {
        this.activeUIs["delete"](_0x41b5e4.id);
        return;
      }
      const _0xbd2abe = _0x10bb77.selection;
      if (_0xbd2abe === 0x0) {
        if (_0x41b5e4.dimension.id === "minecraft:the_end") {
          this.startEarthReturnSequence(_0x41b5e4, this.findNearbyRocket(_0x41b5e4));
        } else {
          this.startMoonJourneySequence(_0x41b5e4, this.findNearbyRocket(_0x41b5e4));
        }
      }
    } catch (_0x234bc7) {} finally {
      this.activeUIs["delete"](_0x41b5e4.id);
    }
  }
  ['findNearbyRocket'](_0x51495b) {
    const _0x582273 = _0x51495b.location;
    const _0x23f928 = _0x51495b.dimension;
    try {
      const _0x224bbe = _0x23f928.getEntities({
        'type': "jerry:rocket"
      });
      let _0x17209a = null;
      let _0x3edc19 = 0xa;
      for (const _0x12f8f5 of _0x224bbe) {
        const _0x10a666 = this.calculateDistance(_0x582273, _0x12f8f5.location);
        if (_0x10a666 < _0x3edc19) {
          _0x3edc19 = _0x10a666;
          _0x17209a = _0x12f8f5;
        }
      }
      return _0x17209a;
    } catch (_0x27eb82) {
      return null;
    }
  }
  ["calculateDistance"](_0x42e2dd, _0x1ada51) {
    const _0x410693 = _0x42e2dd.x - _0x1ada51.x;
    const _0x44f111 = _0x42e2dd.y - _0x1ada51.y;
    const _0x3cc9bc = _0x42e2dd.z - _0x1ada51.z;
    return Math.sqrt(_0x410693 * _0x410693 + _0x44f111 * _0x44f111 + _0x3cc9bc * _0x3cc9bc);
  }
  ['startMoonJourneySequence'](_0x10b475, _0x4ba992) {
    if (!_0x4ba992) {
      return;
    }
    try {} catch (_0x55b95f) {}
    if (this.flyingRockets.has(_0x4ba992.id)) {
      return;
    }
    if (this.usedRockets.has(_0x4ba992.id)) {
      return;
    }
    const _0x482ac2 = _0x10b475.location;
    const _0x51dbb8 = {
      'location': {
        'x': _0x482ac2.x,
        'y': _0x482ac2.y,
        'z': _0x482ac2.z
      },
      'dimension': _0x10b475.dimension.id
    };
    this.originalLocations.set(_0x10b475.name, _0x51dbb8);
    try {} catch (_0x337182) {}
    this.savePersistentData();
    this.launchRocket(_0x10b475, _0x4ba992);
  }
  ['launchRocket'](_0x1e3919, _0x31659a) {
    try {
      if (this.flyingRockets.has(_0x31659a.id)) {
        return;
      }
      if (this.spaceBubble.activeBubbles.has(_0x31659a.id)) {
        this.spaceBubble.removeBubble(_0x31659a.id);
      }
      _0x31659a.triggerEvent("jerry:start_flying");
      _0x1e3919.runCommand("camerashake add @s 0.2 10 positional");
      this.startPreLaunchSmoke(_0x31659a);
      system.runTimeout(() => {
        try {
          if (this.flyingRockets.has(_0x31659a.id)) {
            return;
          }
          const _0xdf28cf = {
            'rocket': _0x31659a,
            'player': _0x1e3919,
            'isFlying': true,
            'flightTime': 0x0,
            'altitude': _0x31659a.location.y,
            'hasLiftedOff': false,
            'spaceBubble': null,
            'engineSoundPlaying': false
          };
          this.flyingRockets.set(_0x31659a.id, _0xdf28cf);
          this.startRocketEngineSound(_0x31659a, _0xdf28cf);
          _0x1e3919.runCommand("camerashake add @s 0.8 54 positional");
        } catch (_0x1b1d11) {}
      }, 0x3c);
    } catch (_0x32ef8e) {}
  }
  ['landRocket'](_0x45d2d6, _0xd17cb4) {
    try {
      const _0x42b12d = _0x45d2d6.dimension.id;
      if (_0x42b12d === "minecraft:overworld") {
        this.fogManager.applyMoonFog(_0x45d2d6, 'MOON');
        const _0x3978ec = this.spaceBubble.getBubble(_0xd17cb4.id);
        if (_0x3978ec) {} else {}
      } else if (_0x42b12d === "minecraft:the_end") {
        if (this.fogManager.hasActiveFog(_0x45d2d6)) {
          this.fogManager.removeMoonFog(_0x45d2d6);
        }
        this.returnToEarth(_0x45d2d6, _0xd17cb4);
      }
    } catch (_0x135bf1) {}
  }
  ['startRocketEngineSound'](_0x386bce, _0x28383c) {
    try {
      if (!_0x386bce || !_0x386bce.isValid() || _0x28383c.engineSoundPlaying) {
        return;
      }
      _0x386bce.runCommand("playsound jerry.rocket.engine @a ~ ~ ~ 0.8 1.0 100");
      _0x28383c.engineSoundPlaying = true;
    } catch (_0x1ceca8) {}
  }
  ["stopRocketEngineSound"](_0x5c63b8, _0x30fc8c) {
    try {
      if (!_0x5c63b8 || !_0x5c63b8.isValid() || !_0x30fc8c.engineSoundPlaying) {
        return;
      }
      _0x5c63b8.runCommand("stopsound @a jerry.rocket.engine");
      _0x30fc8c.engineSoundPlaying = false;
    } catch (_0x2862ab) {}
  }
  ["updateRocketMovement"](_0x32a93d) {
    try {
      const {
        rocket: _0xb1672b,
        player: _0x5c7ea5,
        flightTime: _0x574e41
      } = _0x32a93d;
      if (!_0xb1672b.isValid()) {
        this.stopRocketEngineSound(_0xb1672b, _0x32a93d);
        this.flyingRockets["delete"](_0xb1672b.id);
        return;
      }
      const _0x236857 = _0xb1672b.location;
      let _0x379136 = Math.min(0.5 + _0x574e41 * 0.001, 0x2);
      if (!_0x32a93d.hasLiftedOff && _0x236857.y > _0x32a93d.altitude + 0xa) {
        _0x32a93d.hasLiftedOff = true;
      }
      const _0x2026b4 = {
        'x': _0x236857.x,
        'y': _0x236857.y + _0x379136,
        'z': _0x236857.z
      };
      if (_0x5c7ea5 && _0x5c7ea5.isValid() && _0x32a93d.flightTime >= 0x190) {
        this.updateFlightFog(_0x5c7ea5, _0x2026b4.y);
      }
      if (_0x32a93d.hasLiftedOff && this.checkRocketCollision(_0xb1672b, _0x2026b4)) {
        this.crashRocket(_0xb1672b, _0x32a93d.player);
        return;
      }
      if (_0x2026b4.y < 0x1b58) {
        _0xb1672b.teleport(_0x2026b4);
      }
      this.spawnRocketThrustParticles(_0xb1672b);
      _0x32a93d.flightTime++;
      if (_0x32a93d.flightTime % 0x78 === 0x0 && _0x32a93d.engineSoundPlaying) {
        _0xb1672b.runCommand("playsound jerry.rocket.engine @a ~ ~ ~ 0.8 1.0 100");
      }
      if (_0x32a93d.isMoonLaunch && _0x32a93d.flightTime >= 0x64 && !_0x32a93d.moonLiftoffComplete) {
        _0x32a93d.moonLiftoffComplete = true;
        return;
      }
      if (_0x32a93d.flightTime % 0x64 === 0x0) {
        if (_0x5c7ea5 && _0x5c7ea5.isValid()) {}
      }
      if (_0x32a93d.flightTime === 0xc8 && !_0x32a93d.spaceBubble) {
        if (this.spaceBubble.activeBubbles.has(_0xb1672b.id)) {
          _0x32a93d.spaceBubble = this.spaceBubble.activeBubbles.get(_0xb1672b.id).bubble;
        } else {
          if (_0x5c7ea5 && _0x5c7ea5.isValid()) {}
          const _0x5132a4 = this.spaceBubble.createBubble(_0xb1672b);
          _0x32a93d.spaceBubble = _0x5132a4;
          if (_0x5132a4) {
            if (_0x5c7ea5 && _0x5c7ea5.isValid()) {}
            _0x5132a4.triggerEvent("jerry:set_stage1");
          } else {
            if (_0x5c7ea5 && _0x5c7ea5.isValid()) {}
          }
        }
      }
    } catch (_0xf96c0d) {}
  }
  ['updateFlightFog'](_0x5f3f20, _0x1d94a6) {
    try {
      if (_0x1d94a6 > 0x12c) {
        if (this.fogManager.getCurrentFogType(_0x5f3f20) !== 'SPACE') {
          this.fogManager.applyMoonFog(_0x5f3f20, "SPACE");
        }
      } else if (_0x1d94a6 > 0x96) {
        if (this.fogManager.getCurrentFogType(_0x5f3f20) !== 'MOON') {
          this.fogManager.applyMoonFog(_0x5f3f20, "MOON");
        }
      }
    } catch (_0x4da599) {}
  }
  ['checkRocketCollision'](_0x348ee6, _0x1bcb77) {
    try {
      const _0x588ace = _0x348ee6.dimension;
      if (_0x588ace.id === "minecraft:the_end") {
        return false;
      }
      if (_0x1bcb77.y > 0x1f4) {
        return false;
      }
      const _0x308c1f = [{
        'x': 0x0,
        'y': 0x0,
        'z': 0x0
      }, {
        'x': 0x2,
        'y': 0x0,
        'z': 0x0
      }, {
        'x': -0x2,
        'y': 0x0,
        'z': 0x0
      }, {
        'x': 0x0,
        'y': 0x0,
        'z': 0x2
      }, {
        'x': 0x0,
        'y': 0x0,
        'z': -0x2
      }, {
        'x': 0x0,
        'y': 0x3,
        'z': 0x0
      }];
      for (const _0x209b5b of _0x308c1f) {
        const _0x365545 = {
          'x': Math.floor(_0x1bcb77.x + _0x209b5b.x),
          'y': Math.floor(_0x1bcb77.y + _0x209b5b.y),
          'z': Math.floor(_0x1bcb77.z + _0x209b5b.z)
        };
        try {
          const _0x23ce32 = _0x588ace.getBlock(_0x365545);
          if (_0x23ce32 && _0x23ce32.typeId !== "minecraft:air" && _0x23ce32.typeId !== "minecraft:void_air") {
            return true;
          }
        } catch (_0x27e921) {
          if (_0x1bcb77.y > 0x12c) {
            continue;
          }
          return true;
        }
      }
      return false;
    } catch (_0x47f8c6) {
      return false;
    }
  }
  ["handleRocketSteering"](_0x403e62, _0x1891bc) {}
  ["crashRocket"](_0x11cebf, _0x3199b7) {
    try {
      const _0x359a3a = this.flyingRockets.get(_0x11cebf.id);
      if (_0x359a3a) {
        this.stopRocketEngineSound(_0x11cebf, _0x359a3a);
      }
      this.explodeRocket(_0x11cebf, _0x3199b7);
      this.flyingRockets["delete"](_0x11cebf.id);
      if (_0x3199b7 && _0x3199b7.isValid()) {}
    } catch (_0x4570d1) {}
  }
  ["explodeRocket"](_0x2fa840, _0x461fc4 = null) {
    try {
      const _0x2ee1d0 = _0x2fa840.location;
      const _0x2085ee = _0x2fa840.dimension;
      _0x2085ee.createExplosion(_0x2ee1d0, 0xf, {
        'breaksBlocks': true,
        'allowUnderwater': true,
        'source': _0x2fa840,
        'causesiFire': true
      });
      for (let _0x2ab020 = 0x0; _0x2ab020 < 0x8; _0x2ab020++) {
        system.runTimeout(() => {
          const _0x776278 = {
            'x': _0x2ee1d0.x + (Math.random() - 0.5) * 0x14,
            'y': _0x2ee1d0.y + (Math.random() - 0.5) * 0xa,
            'z': _0x2ee1d0.z + (Math.random() - 0.5) * 0x14
          };
          _0x2085ee.createExplosion(_0x776278, 0x8, {
            'breaksBlocks': true,
            'allowUnderwater': true,
            'source': _0x2fa840,
            'causesiFire': true
          });
        }, _0x2ab020 * 0x5);
      }
      this.createFirePatches(_0x2085ee, _0x2ee1d0);
      this.flyingRockets["delete"](_0x2fa840.id);
      if (_0x461fc4 && _0x461fc4.isValid()) {
        this.fogManager.clearPlayerFog(_0x461fc4);
      }
    } catch (_0x133816) {}
  }
  ["createDeathExplosion"](_0x35feff) {
    try {
      const _0x3e1b99 = _0x35feff.location;
      const _0x584602 = _0x35feff.dimension;
      _0x584602.createExplosion(_0x3e1b99, 0xc, {
        'breaksBlocks': true,
        'allowUnderwater': true,
        'source': _0x35feff,
        'causesiFire': true
      });
      for (let _0x4aa482 = 0x0; _0x4aa482 < 0x5; _0x4aa482++) {
        system.runTimeout(() => {
          const _0x16e8b3 = {
            'x': _0x3e1b99.x + (Math.random() - 0.5) * 0xf,
            'y': _0x3e1b99.y + (Math.random() - 0.5) * 0x8,
            'z': _0x3e1b99.z + (Math.random() - 0.5) * 0xf
          };
          _0x584602.createExplosion(_0x16e8b3, 0x6, {
            'breaksBlocks': true,
            'allowUnderwater': true,
            'source': _0x35feff,
            'causesiFire': true
          });
        }, _0x4aa482 * 0x3);
      }
      this.createFirePatches(_0x584602, _0x3e1b99);
    } catch (_0xb4cb72) {}
  }
  ["createFirePatches"](_0x2e45b3, _0x5a5c77) {
    try {
      const _0x5e8640 = Math.floor(Math.random() * 0xb) + 0xf;
      for (let _0x300912 = 0x0; _0x300912 < _0x5e8640; _0x300912++) {
        const _0x47928f = {
          'x': Math.floor(_0x5a5c77.x + (Math.random() - 0.5) * 0x1e),
          'y': Math.floor(_0x5a5c77.y + (Math.random() - 0.5) * 0xa),
          'z': Math.floor(_0x5a5c77.z + (Math.random() - 0.5) * 0x1e)
        };
        try {
          const _0x543b82 = _0x2e45b3.getBlock(_0x47928f);
          if (_0x543b82 && _0x543b82.typeId === 'minecraft:air') {
            const _0x35ff30 = _0x2e45b3.getBlock({
              'x': _0x47928f.x,
              'y': _0x47928f.y - 0x1,
              'z': _0x47928f.z
            });
            if (_0x35ff30 && _0x35ff30.typeId !== 'minecraft:air') {
              _0x543b82.setType("minecraft:fire");
            }
          }
        } catch (_0x2f735b) {}
      }
    } catch (_0x564501) {}
  }
  ["startPreLaunchEffects"](_0x50257e, _0x56b820) {
    try {
      const _0x17d259 = _0x56b820.location;
      const _0x4d1d76 = _0x56b820.dimension;
      for (let _0x1f51e7 = 0x0; _0x1f51e7 < 0xa; _0x1f51e7++) {
        system.runTimeout(() => {
          if (_0x56b820.isValid()) {
            const _0x110655 = {
              'x': _0x17d259.x + (Math.random() - 0.5) * 0x2,
              'y': _0x17d259.y - 0x1,
              'z': _0x17d259.z + (Math.random() - 0.5) * 0x2
            };
            _0x4d1d76.spawnParticle("minecraft:campfire_smoke_particle", _0x110655);
          }
        }, _0x1f51e7 * 0x5);
      }
    } catch (_0x36b3cc) {}
  }
  ['startPreLaunchSmoke'](_0xc60a9) {
    try {
      const _0x1d170d = _0xc60a9.location;
      const _0x10160a = _0xc60a9.dimension;
      for (let _0x5a8f11 = 0x0; _0x5a8f11 < 0x3c; _0x5a8f11++) {
        system.runTimeout(() => {
          if (_0xc60a9.isValid()) {
            const _0x174abb = Math.random() * 0x2 * Math.PI;
            const _0x39eaf8 = 0x1 + Math.random() * 0x3;
            const _0x3fd178 = Math.random() * 0x2;
            const _0x2bc7a9 = {
              'x': _0x1d170d.x + Math.cos(_0x174abb) * _0x39eaf8,
              'y': _0x1d170d.y - 0x1 + _0x3fd178,
              'z': _0x1d170d.z + Math.sin(_0x174abb) * _0x39eaf8
            };
            _0x10160a.spawnParticle('minecraft:campfire_smoke_particle', _0x2bc7a9);
          }
        }, _0x5a8f11 * 0x1);
      }
    } catch (_0x5ab6e4) {}
  }
  ["spawnRocketThrustParticles"](_0x43a7d5) {
    try {
      if (!_0x43a7d5.isValid()) {
        return;
      }
      const _0x2a5a86 = _0x43a7d5.location;
      const _0x401282 = _0x43a7d5.dimension;
      for (let _0x5dae73 = 0x0; _0x5dae73 < 0x3; _0x5dae73++) {
        const _0x6c14ca = {
          'x': _0x2a5a86.x + (Math.random() - 0.5) * 1.5,
          'y': _0x2a5a86.y - 0x2 - Math.random(),
          'z': _0x2a5a86.z + (Math.random() - 0.5) * 1.5
        };
        if (Math.random() < 0.7) {
          _0x401282.spawnParticle("minecraft:basic_flame_particle", _0x6c14ca);
        } else {
          _0x401282.spawnParticle("minecraft:campfire_smoke_particle", _0x6c14ca);
        }
      }
    } catch (_0x55ff67) {}
  }
  ["startEarthReturnSequence"](_0x34c0a3, _0x3ed4f2) {
    this.flyingRockets.set(_0x3ed4f2.id, {
      'rocket': _0x3ed4f2,
      'player': _0x34c0a3,
      'isFlying': true,
      'flightTime': 0x0,
      'altitude': _0x3ed4f2.location.y,
      'hasLiftedOff': false,
      'spaceBubble': null,
      'isMoonLaunch': true,
      'moonLiftoffComplete': false
    });
    this.startPreLaunchEffects(_0x34c0a3, _0x3ed4f2);
    system.runTimeout(() => {
      this.startMoonLiftoff(_0x34c0a3, _0x3ed4f2);
    }, 0x3c);
  }
  ["startMoonLiftoff"](_0x5e5ee1, _0xc9b756) {
    try {
      const _0x3ae52f = {
        'rocket': _0xc9b756,
        'player': _0x5e5ee1,
        'isFlying': true,
        'flightTime': 0x0,
        'altitude': _0xc9b756.location.y,
        'hasLiftedOff': false,
        'spaceBubble': null,
        'engineSoundPlaying': false,
        'isMoonLaunch': true,
        'moonLiftoffComplete': false
      };
      this.flyingRockets.set(_0xc9b756.id, _0x3ae52f);
      _0xc9b756.triggerEvent('jerry:start_flying');
      this.startRocketEngineSound(_0xc9b756, _0x3ae52f);
      _0x5e5ee1.runCommand("camerashake add @s 0.8 54 positional");
      system.runTimeout(() => {
        this.returnToEarth(_0x5e5ee1, _0xc9b756);
      }, 0x64);
    } catch (_0x12396f) {
      this.returnToEarth(_0x5e5ee1, _0xc9b756);
    }
  }
  ["returnToEarth"](_0x2d77a7, _0x886094) {
    try {
      if (this.fogManager.hasActiveFog(_0x2d77a7)) {
        this.fogManager.clearPlayerFog(_0x2d77a7);
      }
      let _0x49f5bf = null;
      let _0x27c531 = null;
      if (_0x886094 && _0x886094.isValid()) {
        _0x49f5bf = this.rocketOwners.get(_0x886094.id);
        _0x27c531 = _0x886094.id;
        try {
          _0x886094.kill();
        } catch (_0x25a917) {
          try {
            _0x886094.remove();
          } catch (_0x493bec) {}
        }
        this.rocketOwners['delete'](_0x886094.id);
        if (this.usedRockets.has(_0x886094.id)) {
          this.usedRockets["delete"](_0x886094.id);
          this.savePersistentData();
        }
      } else {}
      if (_0x27c531 && this.flyingRockets.has(_0x27c531)) {
        const _0x934e4d = this.flyingRockets.get(_0x27c531);
        if (_0x934e4d && _0x886094 && _0x886094.isValid()) {
          this.stopRocketEngineSound(_0x886094, _0x934e4d);
        }
        this.flyingRockets["delete"](_0x27c531);
      }
      if (_0x27c531) {
        try {
          this.spaceBubble.removeBubble(_0x27c531);
        } catch (_0xc9f6fb) {}
      }
      this.clearPlayerUIStates(_0x2d77a7.id);
      let _0x2b05f1 = this.originalLocations.get(_0x2d77a7.name);
      if (!_0x2b05f1) {
        try {
          _0x2d77a7.sendMessage("§c[DEBUG ERROR] No original location found! Using fallback (0,100,0)");
          _0x2d77a7.sendMessage("§c[DEBUG] Available keys: " + Array.from(this.originalLocations.keys()).join(", "));
        } catch (_0x472962) {}
        _0x2b05f1 = {
          'location': {
            'x': 0x0,
            'y': 0x64,
            'z': 0x0
          },
          'dimension': "minecraft:overworld"
        };
      } else {
        try {} catch (_0x14b437) {}
        if (Math.abs(_0x2b05f1.location.x) > 0x2710 || Math.abs(_0x2b05f1.location.z) > 0x2710 || _0x2b05f1.location.y > 0x96) {
          try {} catch (_0x3ffb58) {}
        }
      }
      const _0x8ec84a = {
        'x': _0x2b05f1.location.x,
        'y': _0x2b05f1.location.y,
        'z': _0x2b05f1.location.z
      };
      const _0x23e8f7 = world.getDimension(_0x2b05f1.dimension);
      try {
        _0x2d77a7.runCommand("ride @s stop_riding");
        try {} catch (_0x141ea6) {}
      } catch (_0x5b97b7) {}
      try {} catch (_0x494fc9) {}
      try {
        _0x2d77a7.runCommand("execute in overworld run tp @s " + _0x8ec84a.x + " " + _0x8ec84a.y + " " + _0x8ec84a.z);
        try {} catch (_0x2a16f5) {}
      } catch (_0x40c1f5) {
        try {
          _0x2d77a7.teleport(_0x8ec84a, {
            'dimension': _0x23e8f7,
            'rotation': {
              'x': 0x0,
              'y': 0x0
            },
            'facingLocation': {
              'x': _0x8ec84a.x,
              'y': _0x8ec84a.y - 0x1,
              'z': _0x8ec84a.z
            },
            'checkForBlocks': false,
            'keepVelocity': false
          });
          try {} catch (_0x5451cf) {}
        } catch (_0x3e64ea) {
          try {} catch (_0x13fcc1) {}
        }
      }
      try {
        system.runTimeout(() => {
          if (_0x2d77a7 && _0x2d77a7.isValid()) {}
        }, 0x14);
      } catch (_0x47ed89) {}
      system.runTimeout(() => {
        if (this.fogManager.hasActiveFog(_0x2d77a7)) {
          this.fogManager.clearPlayerFog(_0x2d77a7);
        }
      }, 0x5);
      system.runTimeout(() => {
        if (this.fogManager.hasActiveFog(_0x2d77a7)) {
          this.fogManager.clearPlayerFog(_0x2d77a7);
        }
      }, 0x14);
      system.runTimeout(() => {
        if (_0x27c531) {
          try {
            const _0x6f92ed = world.getDimension("minecraft:the_end");
            const _0x10b82f = _0x6f92ed.getEntities({
              'type': "jerry:rocket"
            });
            for (const _0x15d56d of _0x10b82f) {
              if (_0x15d56d.id === _0x27c531) {
                _0x15d56d.kill();
              }
            }
          } catch (_0x2ad855) {}
        }
        try {
          const _0x291271 = _0x23e8f7.spawnEntity("jerry:rocket", _0x8ec84a);
          if (_0x291271) {
            _0x291271.triggerEvent("jerry:stop_flying");
            if (_0x49f5bf) {
              this.rocketOwners.set(_0x291271.id, _0x49f5bf);
              this.savePersistentData();
            }
            if (this.usedRockets.has(_0x291271.id)) {
              this.usedRockets["delete"](_0x291271.id);
              this.savePersistentData();
            }
            try {
              _0x291271.runCommand("effect @s slow_falling 60 0");
            } catch (_0x114298) {}
          }
        } catch (_0x11f525) {}
      }, 0x28);
      this.originalLocations["delete"](_0x2d77a7.name);
      this.savePersistentData();
    } catch (_0x216fc3) {
      if (_0x886094 && _0x886094.isValid()) {
        const _0x19446f = this.flyingRockets.get(_0x886094.id);
        if (_0x19446f) {
          this.stopRocketEngineSound(_0x886094, _0x19446f);
        }
        this.flyingRockets['delete'](_0x886094.id);
      }
    }
  }
  ["getFogManager"]() {
    return this.fogManager;
  }
  ["toggleMoonFog"](_0x5211a6) {
    if (this.fogManager.hasActiveFog(_0x5211a6)) {
      this.fogManager.removeMoonFog(_0x5211a6);
    } else {
      this.fogManager.applyMoonFog(_0x5211a6);
    }
  }
}
class Moon {
  constructor() {}
  ["initialize"]() {}
}
class SpaceExplorationMain {
  constructor() {
    this.spaceBubble = new SpaceBubble();
    this.rocket = new Rocket(this.spaceBubble);
    this.chunkGenerator = new ChunkGenerator();
    this.moon = new Moon();
    this.previousRidingStates = new Map();
    this.launchPadCooldowns = new Map();
    this.rocketValidationCooldowns = new Map();
    this.spaceBubble.rocketSystem = this.rocket;
  }
  ['initialize']() {
    this.spaceBubble.initialize();
    this.rocket.initialize();
    this.chunkGenerator.initialize();
    this.moon.initialize();
    this.setupEventListeners();
  }
  ["validateRocketPlacement"](_0x4fcbd8) {
    try {
      const _0x359f4e = _0x4fcbd8.x;
      const _0x5193f7 = _0x4fcbd8.y;
      const _0x44575a = _0x4fcbd8.z;
      let _0x285961;
      try {
        const _0x2c26df = world.getPlayers();
        if (_0x2c26df.length > 0x0) {
          _0x285961 = _0x2c26df[0x0].dimension;
        } else {
          _0x285961 = world.getDimension("minecraft:overworld");
        }
      } catch (_0x4e35e3) {
        _0x285961 = world.getDimension("minecraft:overworld");
      }
      for (let _0x44f2d1 = _0x359f4e - 0x1; _0x44f2d1 <= _0x359f4e + 0x1; _0x44f2d1++) {
        for (let _0x1190bc = _0x44575a - 0x1; _0x1190bc <= _0x44575a + 0x1; _0x1190bc++) {
          const _0x3876ad = {
            'x': _0x44f2d1,
            'y': _0x5193f7,
            'z': _0x1190bc
          };
          try {
            const _0xadcf92 = _0x285961.getBlock(_0x3876ad);
            if (!_0xadcf92 || _0xadcf92.typeId !== "jerry:waxed_copper_vent") {
              return false;
            }
          } catch (_0x2d8d13) {
            return false;
          }
        }
      }
      return true;
    } catch (_0x9ad542) {
      return false;
    }
  }
  ["placeLaunchPad"](_0x469a46, _0x3b39f2, _0x5e3cb1) {
    try {
      const _0x366029 = _0x469a46.id;
      const _0xac099d = Date.now();
      const _0x52aaa8 = this.launchPadCooldowns.get(_0x366029) || 0x0;
      if (_0xac099d - _0x52aaa8 < 0xbb8) {
        return;
      }
      this.launchPadCooldowns.set(_0x366029, _0xac099d);
      const _0xb570b3 = _0x469a46.dimension;
      if (!_0x3b39f2 || _0x3b39f2.x === undefined || _0x3b39f2.y === undefined || _0x3b39f2.z === undefined) {
        _0x469a46.sendMessage("§cInvalid block location!");
        return;
      }
      let _0xc76c7 = {
        'x': _0x3b39f2.x,
        'y': _0x3b39f2.y + 0x1,
        'z': _0x3b39f2.z
      };
      try {
        const _0x21724c = _0xb570b3.getBlock(_0xc76c7);
        if (_0x21724c && !_0x21724c.isAir) {
          _0x469a46.sendMessage("§cThere's already a block at that location!");
          return;
        }
      } catch (_0x6baa4e) {}
      try {
        const _0x1dc6d5 = Math.floor(_0xc76c7.x) - 0x3;
        const _0xd65c85 = Math.floor(_0xc76c7.y);
        const _0x237b74 = Math.floor(_0xc76c7.z) - 0x3;
        system.runTimeout(() => {
          try {
            let _0x3d09ca = "structure load launchpad " + _0x1dc6d5 + " " + _0xd65c85 + " " + _0x237b74 + " 0_degrees none";
            let _0x5cc300;
            try {
              _0x5cc300 = _0xb570b3.runCommand(_0x3d09ca);
            } catch (_0x56dd60) {
              try {
                _0x3d09ca = "structure load launchpad " + _0x1dc6d5 + " " + _0xd65c85 + " " + _0x237b74;
                _0x5cc300 = _0xb570b3.runCommand(_0x3d09ca);
              } catch (_0x4b0e58) {
                throw new Error("Structure placement failed on mobile device");
              }
            }
            system.runTimeout(() => {
              try {
                const _0x397a88 = _0xb570b3.getBlock({
                  'x': Math.floor(_0xc76c7.x),
                  'y': Math.floor(_0xc76c7.y),
                  'z': Math.floor(_0xc76c7.z)
                });
                if (_0x397a88 && _0x397a88.typeId === "jerry:waxed_copper_vent") {
                  this.removeLaunchPadFromInventory(_0x469a46);
                } else {
                  _0x469a46.sendMessage("§cError 3491 - Report Screenshot of this error to our discord link found in the guidebook");
                  _0x469a46.sendMessage("§eThis might be a mobile device compatibility issue.");
                }
              } catch (_0xe4e010) {
                _0x469a46.sendMessage("§cError 3490 - Report Screenshot of this error to our discord link found in the guidebook");
                _0x469a46.sendMessage("§eThis might be a mobile device compatibility issue.");
              }
            }, 0x14);
          } catch (_0x2be767) {
            _0x469a46.sendMessage("§cError 3489 - Report Screenshot of this error to our discord link found in the guidebook");
            _0x469a46.sendMessage("§cThis might be a mobile device compatibility issue.");
            _0x469a46.sendMessage("§cError: " + _0x2be767.message);
          }
        }, 0x5);
      } catch (_0x26da21) {
        _0x469a46.sendMessage("§cError 3488 - Report Screenshot of this error to our discord link found in the guidebook");
        _0x469a46.sendMessage("§cDebug: " + _0x26da21.message);
      }
    } catch (_0x2b04a8) {
      _0x469a46.sendMessage("§cError 3487 - Report Screenshot of this error to our discord link found in the guidebook");
      _0x469a46.sendMessage("§cDebug: " + _0x2b04a8.message);
    }
  }
  ["removeLaunchPadFromInventory"](_0x4f0885) {
    try {
      const _0x45602b = _0x4f0885.getComponent("minecraft:inventory");
      if (_0x45602b && _0x45602b.container) {
        const _0x503f33 = _0x4f0885.selectedSlotIndex;
        const _0x470d01 = _0x45602b.container.getItem(_0x503f33);
        if (_0x470d01 && _0x470d01.typeId === "jerry:launch_pad") {
          if (_0x470d01.amount > 0x1) {
            _0x470d01.amount--;
            _0x45602b.container.setItem(_0x503f33, _0x470d01);
          } else {
            _0x45602b.container.setItem(_0x503f33, undefined);
          }
        }
      }
    } catch (_0x4bb211) {}
  }
  ['setupEventListeners']() {
    try {
      if (world.beforeEvents && world.beforeEvents.itemUseOn) {
        world.beforeEvents.itemUseOn.subscribe(_0x21cb2d => {
          if (_0x21cb2d.itemStack?.['typeId'] === "jerry:launch_pad") {
            _0x21cb2d.cancel = true;
            system.runTimeout(() => {
              this.placeLaunchPad(_0x21cb2d.source, _0x21cb2d.block.location, _0x21cb2d.blockFace);
            }, 0x1);
          } else {
            if (_0x21cb2d.itemStack?.["typeId"] === 'jerry:rocket') {
              const _0xce4e52 = _0x21cb2d.source.id;
              const _0x54fa63 = Date.now();
              const _0x4c3ee3 = this.rocketValidationCooldowns.get(_0xce4e52) || 0x0;
              if (!this.validateRocketPlacement(_0x21cb2d.block.location)) {
                _0x21cb2d.cancel = true;
                if (_0x54fa63 - _0x4c3ee3 > 0x7d0) {
                  _0x21cb2d.source.sendMessage("§cRockets must be placed in the middle of a launchpad.");
                  this.rocketValidationCooldowns.set(_0xce4e52, _0x54fa63);
                }
              } else {
                system.runTimeout(() => {
                  try {
                    const _0x2a43a5 = _0x21cb2d.source;
                    const _0x1578f7 = _0x2a43a5.getComponent('minecraft:inventory');
                    if (_0x1578f7 && _0x1578f7.container) {
                      const _0x2302da = _0x1578f7.container;
                      for (let _0x5bf961 = 0x0; _0x5bf961 < _0x2302da.size; _0x5bf961++) {
                        const _0x214d7c = _0x2302da.getItem(_0x5bf961);
                        if (_0x214d7c && _0x214d7c.typeId === "jerry:rocket") {
                          if (_0x214d7c.amount > 0x1) {
                            _0x214d7c.amount -= 0x1;
                            _0x2302da.setItem(_0x5bf961, _0x214d7c);
                          } else {
                            _0x2302da.setItem(_0x5bf961, undefined);
                          }
                          break;
                        }
                      }
                    }
                  } catch (_0x2431f9) {}
                }, 0x5);
              }
            }
          }
        });
      }
    } catch (_0x2e3784) {}
    system.runInterval(() => {
      for (const _0x1f62bd of world.getPlayers()) {
        const _0x4c0974 = _0x1f62bd.getComponent("riding");
        const _0x466806 = _0x4c0974 && _0x4c0974.entityRidingOn && _0x4c0974.entityRidingOn.typeId === "jerry:rocket";
        const _0x1b1d66 = _0x1f62bd.id;
        const _0x539d4b = this.previousRidingStates.get(_0x1b1d66) || false;
        if (_0x466806) {
          const _0x9162e2 = _0x4c0974.entityRidingOn;
          const _0x1baed0 = _0x9162e2.id;
          const _0xe7b1cb = _0x1b1d66 + '_' + _0x1baed0;
          if (this.rocket.flyingRockets.has(_0x1baed0)) {
            this.previousRidingStates.set(_0x1b1d66, true);
            continue;
          }
          if (!this.rocket.hasShownUI(_0xe7b1cb)) {
            this.rocket.onPlayerEnterRocket(_0x1f62bd, _0x9162e2, _0xe7b1cb);
          }
          this.previousRidingStates.set(_0x1b1d66, true);
        } else {
          try {
            _0x1f62bd.runCommand("camerashake stop @s");
          } catch (_0x21000d) {}
          if (_0x539d4b) {
            this.rocket.clearPlayerUIStates(_0x1b1d66);
            if (this.rocket.getFogManager().hasActiveFog(_0x1f62bd)) {
              this.rocket.getFogManager().clearPlayerFog(_0x1f62bd);
            }
          }
          this.previousRidingStates.set(_0x1b1d66, false);
        }
      }
    }, 0xa);
    try {
      if (world.beforeEvents && world.beforeEvents.chatSend) {
        world.beforeEvents.chatSend.subscribe(_0xae47c1 => {
          const _0x32b040 = _0xae47c1.sender;
          const _0x142012 = _0xae47c1.message.toLowerCase();
          if (_0x142012 === '!togglefog' || _0x142012 === "!fog") {
            _0xae47c1.cancel = true;
            this.rocket.toggleMoonFog(_0x32b040);
          } else {
            if (_0x142012 === '!fogstatus') {
              _0xae47c1.cancel = true;
            } else {
              if (_0x142012 === "!moonsfog") {
                _0xae47c1.cancel = true;
                this.rocket.getFogManager().applyMoonFog(_0x32b040, "MOON");
              } else {
                if (_0x142012 === "!spacefog") {
                  _0xae47c1.cancel = true;
                  this.rocket.getFogManager().applyMoonFog(_0x32b040, 'SPACE');
                } else {
                  if (_0x142012 === "!clearfog") {
                    _0xae47c1.cancel = true;
                    this.rocket.getFogManager().clearPlayerFog(_0x32b040);
                  } else if (_0x142012 === '!foghelp') {
                    _0xae47c1.cancel = true;
                  }
                }
              }
            }
          }
        });
      } else {}
    } catch (_0x2da980) {}
    system.runInterval(() => {
      const _0xb371f5 = world.getPlayers();
      for (const _0x15b563 of _0xb371f5) {
        if (_0x15b563.dimension.id === 'minecraft:the_end') {
          try {
            this.chunkGenerator.generateChunksAroundPlayer(_0x15b563);
          } catch (_0x4c779f) {}
        }
      }
    }, 0x28);
    system.runInterval(() => {
      const _0x23a870 = world.getPlayers();
      let _0x1b8151 = 0x0;
      let _0x137fbd = 0x0;
      for (const _0x176e6b of _0x23a870) {
        let _0x1d2751 = false;
        try {
          const _0x1bf313 = _0x176e6b.getComponent("riding");
          if (_0x1bf313 && _0x1bf313.entityRidingOn) {
            const _0x353f78 = _0x1bf313.entityRidingOn;
            if (_0x353f78.typeId === "jerry:rocket") {
              if (this.rocket.flyingRockets.has(_0x353f78.id)) {
                _0x1d2751 = true;
              }
            }
          }
        } catch (_0x49c91) {}
        if (_0x176e6b.dimension.id === "minecraft:overworld" || _0x176e6b.dimension.id === "minecraft:nether") {
          if (!_0x1d2751) {
            try {
              _0x176e6b.runCommand("fog @s remove moon_atmosphere_moon");
              _0x176e6b.runCommand("fog @s remove moon_atmosphere_space");
              if (this.rocket.getFogManager().hasActiveFog(_0x176e6b)) {
                this.rocket.getFogManager().clearPlayerFog(_0x176e6b);
                _0x137fbd++;
              }
              _0x1b8151++;
            } catch (_0x4796f7) {}
          }
        }
      }
      if (Math.random() < 0.2) {}
    }, 0x64);
    world.afterEvents.entityHitEntity.subscribe(_0x37d820 => {
      if (_0x37d820.hitEntity.typeId === "jerry:rocket" && _0x37d820.damagingEntity.typeId === "minecraft:player") {
        this.rocket.onPlayerEnterRocket(_0x37d820.damagingEntity, _0x37d820.hitEntity);
      }
    });
  }
}
let SPACE_EXPLORATION_INITIALIZED = false;
const spaceExploration = new SpaceExplorationMain();
system.run(() => {
  if (SPACE_EXPLORATION_INITIALIZED) {
    return;
  }
  spaceExploration.initialize();
  SPACE_EXPLORATION_INITIALIZED = true;
  const _0x8522b3 = world.getPlayers();
  for (const _0x5a2c3e of _0x8522b3) {
    if (_0x5a2c3e.dimension.id === "minecraft:the_end") {
      try {
        spaceExploration.chunkGenerator.generateChunksAroundPlayer(_0x5a2c3e);
      } catch (_0x2ebb0c) {}
    }
  }
});
system.runInterval(() => {
  const _0x1e8937 = world.getPlayers();
  for (const _0x56f99b of _0x1e8937) {
    if (_0x56f99b.dimension.id === "minecraft:the_end") {}
  }
}, 0x3c);
const musicDiscs = {
  'jerry:music_disc_flymetothemoon': {
    'sound': {
      'volume': 0x1,
      'id': "record.flymetothemoon"
    }
  }
};
if (world.getDynamicProperty("jukeboxes") == undefined) {
  world.setDynamicProperty('jukeboxes', JSON.stringify({}));
}
class jukeboxManager {
  static ["getJukebox"](_0x52222e) {
    const _0x10d637 = this.getAllJukeboxes();
    if (_0x10d637.hasOwnProperty(JSON.stringify(_0x52222e))) {
      return _0x10d637[JSON.stringify(_0x52222e)];
    } else {
      return undefined;
    }
  }
  static ["getAllJukeboxes"]() {
    let _0x447f3b = world.getDynamicProperty("jukeboxes");
    if (_0x447f3b == undefined) {
      _0x447f3b = '{}';
    }
    return JSON.parse(_0x447f3b);
  }
  static ["setJukebox"](_0x3c968c, _0x1988b2) {
    const _0x4b8d30 = this.getAllJukeboxes();
    _0x4b8d30[JSON.stringify(_0x3c968c)] = _0x1988b2;
    world.setDynamicProperty('jukeboxes', JSON.stringify(_0x4b8d30));
  }
  static ["removeJukebox"](_0x387c8b) {
    const _0x46f1c9 = this.getAllJukeboxes();
    delete _0x46f1c9[JSON.stringify(_0x387c8b)];
    world.setDynamicProperty("jukeboxes", JSON.stringify(_0x46f1c9));
  }
}
world.beforeEvents.playerInteractWithBlock.subscribe(_0x3b1eb3 => {
  const {
    player: _0x4996e9,
    block: _0x220065
  } = _0x3b1eb3;
  const _0x52901a = _0x4996e9.getComponent("equippable");
  const _0x3b78a6 = _0x52901a.getEquipmentSlot(EquipmentSlot.Mainhand);
  if (_0x220065.permutation.matches('minecraft:jukebox')) {
    if (jukeboxManager.getJukebox(_0x220065.location) == undefined) {
      jukeboxManager.setJukebox(_0x220065.location, {
        'playing_disc': "nothing"
      });
    }
    const _0x38fa57 = jukeboxManager.getJukebox(_0x220065.location);
    if (_0x3b78a6.hasItem() && _0x38fa57.playing_disc == "nothing") {
      if (musicDiscs.hasOwnProperty(_0x3b78a6?.["typeId"])) {
        system.run(function () {
          const _0x55af66 = _0x52901a.getEquipmentSlot(EquipmentSlot.Mainhand);
          const _0x2a0c42 = musicDiscs[_0x55af66.typeId].sound;
          _0x220065.dimension.playSound(_0x2a0c42.id, _0x220065.location, {
            'volume': _0x2a0c42.volume
          });
          jukeboxManager.setJukebox(_0x220065.location, {
            'playing_disc': _0x55af66.typeId
          });
          _0x52901a.getEquipmentSlot(EquipmentSlot.Mainhand).setItem(undefined);
        });
        return;
      }
    } else {
      if (_0x38fa57.playing_disc != "nothing") {
        const _0x35e0b7 = new ItemStack(_0x38fa57.playing_disc, 0x1);
        jukeboxManager.setJukebox(_0x220065.location, {
          'playing_disc': "nothing"
        });
        system.runTimeout(() => {
          _0x220065.dimension.spawnItem(_0x35e0b7, {
            'x': _0x220065.location.x + 0.5,
            'y': _0x220065.location.y + 0x1,
            'z': _0x220065.location.z + 0.5
          });
          _0x220065.dimension.runCommand("stopsound @a[x=" + _0x220065.location.x + ",y=" + _0x220065.location.y + ',z=' + _0x220065.location.z + ",r=100] " + musicDiscs[_0x38fa57.playing_disc].sound.id);
        });
      }
    }
  }
});
world.afterEvents.playerBreakBlock.subscribe(_0x58ed61 => {
  const {
    block: _0x1c85f6
  } = _0x58ed61;
  if (_0x58ed61.brokenBlockPermutation.matches("minecraft:jukebox")) {
    const _0x4370f9 = jukeboxManager.getJukebox(_0x1c85f6.location);
    if (_0x4370f9?.["playing_disc"] != "nothing") {
      const _0x234bd5 = new ItemStack(_0x4370f9.playing_disc, 0x1);
      _0x1c85f6.dimension.spawnItem(_0x234bd5, {
        'x': _0x1c85f6.location.x + 0.5,
        'y': _0x1c85f6.location.y + 0x1,
        'z': _0x1c85f6.location.z + 0.5
      });
      _0x1c85f6.dimension.runCommand("stopsound @a[x=" + _0x1c85f6.location.x + ",y=" + _0x1c85f6.location.y + ",z=" + _0x1c85f6.location.z + ",r=100] " + musicDiscs[_0x4370f9.playing_disc].sound.id);
    }
    jukeboxManager.removeJukebox(_0x1c85f6.location);
  }
});
world.beforeEvents.worldInitialize.subscribe(_0x170e3f => {
  _0x170e3f.itemComponentRegistry.registerCustomComponent("jerry:moonwalker_potion", {
    'onConsume'(_0x35c1af) {
      const {
        source: _0x388824
      } = _0x35c1af;
      _0x388824.runCommand("effect @s slow_falling 180 0");
      _0x388824.runCommand("effect @s jump_boost 180 1");
    }
  });
});
export { spaceExploration };