Archive eaglercraft-saveeditor (tool, any, clean)

This commit is contained in:
2026-11-27 22:14:50 -06:00
parent dce2f5726b
commit 35c898f467
18 changed files with 1381 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
{
"slug": "eaglercraft-saveeditor",
"name": "Eaglercraft Save Editor (RePack)",
"category": "tool",
"mc_version": "any",
"author": "ayqshi",
"license": "MIT",
"upstream_ref": "main",
"sha256": "67c8f1baeb3404a271999c9cdbe0e2989343f4c279f2220f64dc8fc0482b0206",
"size": 5553951,
"storage": {
"git_path": null,
"fs_url": null
},
"play": {
"sandbox_url": "https://play-archive.eaglercraft.tech/eaglercraft-saveeditor/",
"sandbox_attr": "allow-scripts allow-downloads",
"network_notes": "Browser-runnable world and profile editor"
},
"sources": [
{
"url": "https://github.com/ayqshi/Eaglercraft-SaveEditor",
"retrieved_at": "2026-11-28T03:10:30Z",
"type": "upstream",
"notes": "Source repository on GitHub"
},
{
"url": "https://ayqshi.github.io/Eaglercraft-SaveEditor/",
"retrieved_at": "2026-11-28T03:10:30Z",
"type": "other",
"notes": "Live web application on GitHub Pages"
}
],
"vetting": {
"verdict": "clean",
"tools": [
"vet-static.mjs",
"virustotal-hash",
"static-code-review"
],
"date": "2026-11-28",
"notes": "Uses navigator.clipboard.writeText for copy buttons in index.html:173,188; main.js:1 is a benign scanner hit on MINECRAFT_ITEMS_DB.",
"reviewer": "vet-gemini"
},
"large_files_omitted_from_git": []
}
+11
View File
@@ -0,0 +1,11 @@
# Eaglercraft Save Editor (RePack)
Web-based EPK file extractor, viewer, editor, and repacker for Eaglercraft singleplayer world saves and player data. Inspects file hierarchies and parses NBT structures.
- **Archive page:** https://archive.eaglercraft.tech/entries/eaglercraft-saveeditor.html
- **Play:** https://play-archive.eaglercraft.tech/eaglercraft-saveeditor/
- **MC Version:** any
- **Author:** ayqshi
- **License:** MIT
- **SHA-256:** `67c8f1baeb3404a271999c9cdbe0e2989343f4c279f2220f64dc8fc0482b0206`
- **Vetting:** clean (2026-11-28)
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
THE ISSUES PAGE.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
@@ -0,0 +1,37 @@
# Contributing to RePack
Thank you for considering contributing to RePack! We appreciate your help in making this project better. Please follow the guidelines below to ensure a smooth contribution process.
## How to Contribute
1. **Fork the Repository**: Click the "Fork" button at the top right of the repository page to create your own copy of the project.
2. **Clone Your Fork**: Clone your forked repository to your local machine using the following command:
git clone https://github.com/ayqshi/RePack.git
Create a Branch: Create a new branch for your feature or bug fix:
git checkout -b my-feature-branch
Make Changes: Make your changes in the codebase. Be sure to follow the project's coding style and conventions.
Test Your Changes: Run any tests to ensure your changes work as expected. If applicable, add new tests for your changes.
Commit Your Changes: Commit your changes with a clear and descriptive commit message:
git commit -m "Add a brief description of your changes"
Push to Your Fork: Push your changes to your forked repository:
git push origin my-feature-branch
Create a Pull Request: Go to the original repository and click on the "Pull Requests" tab. Click the "New Pull Request" button and select your branch. Provide a clear description of your changes and submit the pull request.
# Guidelines
Code Style: Please adhere to the coding style used in the project. Consistency is key to maintaining readability.
Documentation: If you add new features or make changes, please update the documentation accordingly.
Issue Tracking: If you are fixing a bug or implementing a feature, please reference the relevant issue in your pull request description.
Reporting Issues
If you encounter any issues or have suggestions for improvements, please open an issue in the repository. Be sure to provide as much detail as possible to help us understand the problem.
## Code of Conduct
By participating in this project, you agree to abide by our Code of Conduct.
## Thank You!
Thank you for your interest in contributing to RePack! We look forward to your contributions and appreciate your help in making this project better.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Ayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+178
View File
@@ -0,0 +1,178 @@
# RePack — Eaglercraft Save Editor
> **Status: Official Launch**
>
> This project is still under active development but is near completion. Expect bugs, rough edges, and incomplete features. If you are not comfortable troubleshooting issues on your own, you may want to wait for a more stable version.
>
> If you are interested in helping improve the project—especially usability and simplicity—contributions are welcome.
> Reach out (discord): **@ayqshi**
---
## What This Project Is
**RePack** is a browser-based tool for inspecting, editing, and rebuilding `.epk` save files used in Eaglercraft.
It is designed for users who want more control over their world data—whether that means exploring file contents, modifying NBT data, or understanding how `.epk` archives are structured internally.
---
# ROADMAP
- Fixing non functional feats
- Making functional bookmarklets (EPK scraper, In-Game Mod Menu)
- .ZIP support
## Features
### EPK Extraction
Decompile `.epk` archives and access their internal files.
* View the full contents of a save
* Understand file structure and layout
* No external tools required
---
### NBT Parsing (Readable JSON)
Automatically converts `.dat` (NBT) files into structured JSON.
* Makes complex binary data readable
* Easier inspection of player and world data
* Simplifies editing workflows
---
### File Editing
Edit supported file types directly in the browser:
* JSON (NBT data)
* Plain text files
Changes are applied in real time and reflected in the repacked archive.
---
### EPK Repacking
Rebuild a valid `.epk` archive after making edits.
* Preserves original structure
* Automatically re-compresses files when required (GZIP)
* Designed to minimize manual intervention
---
### Integrity Checks
Basic validation is included to reduce the chance of corruption:
* Header and footer verification
* CRC32 checks for file data consistency
---
### Binary File Handling
Files that cannot be displayed are still preserved:
* Shown as placeholders in the UI
* Included unchanged during repacking
---
## Usage
1. In Eaglercraft:
* Select your world
* Click **Backup** and export as `.epk`
2. In RePack:
* Open the tool (beta)
* Upload your `.epk` file
3. Browse and edit:
* Select a file from the extracted list
* Its contents will appear in the editor panel
4. Repack:
* Save your changes
* Download the rebuilt `.epk` file
---
## How It Works
RePack runs entirely in your browser using JavaScript. Files are processed locally and are not uploaded to any server.
### EPK Format Overview
An `.epk` archive contains:
* A header
* Version information
* File count (stored as Big-Endian)
* A metadata table for each file:
* Name
* Size
* Offset
* Compression type
* CRC32 checksum
* File data blocks
* A footer
Most numeric values are stored as Little-Endian, except for the file count, which uses Big-Endian encoding.
---
### Internal Processing
When loading a file:
* The archive structure is parsed
* Metadata and offsets are read
* Files are decompressed if necessary
* NBT data is converted into JSON
When repacking:
* Metadata is rebuilt
* Files are recompressed where required
* CRC32 values are recalculated
* A valid `.epk` archive is generated
---
## Dependencies
* **Pako.js** — GZIP compression and decompression
* **NBT.js** — Parsing and handling NBT data
---
## Limitations
* Some edge cases may fail during extraction or repacking
* User interface is minimal and still evolving
* Binary files cannot be edited
* Error handling is not yet comprehensive
---
## Contributing
Feedback and contributions are encouraged, especially in areas like:
* Simplifying the user experience
* Improving error handling
* Expanding file support
---
## Notes
This tool is intended for users who want direct access to and control over their save data. It prioritizes transparency and functionality over polish at this stage of development.
+23
View File
@@ -0,0 +1,23 @@
# Security Policy
## Reporting a Vulnerability
If you discover a security vulnerability within this project, please report it by sending me a message on snapchat: @ayqshi.
Please include the following information in your report:
- A description of the vulnerability
- Steps to reproduce the issue
- Any relevant screenshots or logs
## Supported Versions
We only support the latest version of the project. Older versions may not receive security updates.
## Security Updates
We will make every effort to respond to security vulnerabilities in a timely manner. Security updates will be released as soon as possible.
## Acknowledgements
We appreciate the efforts of the community in helping us improve the security of this project. If you report a vulnerability, we will acknowledge your contribution in the release notes if you wish.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.
+234
View File
@@ -0,0 +1,234 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>RePack — Eaglercraft Save Editor</title>
<meta name="description"
content="Open, edit, and repack Eaglercraft EPK save files directly in your browser. No uploads. No installs.">
<meta name="keywords"
content="EPK editor, Eaglercraft save editor, level.dat, NBT editor, EPK repack, browser tool">
<meta name="robots" content="index, follow">
<meta name="author" content="ayqshi">
<link rel="canonical" href="https://re-pack-delta.vercel.app/">
<meta property="og:type" content="website">
<meta property="og:title" content="RePack — Eaglercraft Save Editor">
<meta property="og:description"
content="Open, edit, and repack Eaglercraft EPK save files directly in your browser.">
<meta property="og:url" content="https://re-pack-delta.vercel.app">
<meta property="og:site_name" content="RePack">
<meta property="og:image" content="https://re-pack-delta.vercel.app/repack.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="RePack — Eaglercraft Save Editor">
<meta name="twitter:image" content="https://re-pack-delta.vercel.app/repack.png">
<meta name="theme-color" content="#000000">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="favicon"
href="https://raw.githubusercontent.com/ayqshi/Eaglercraft-SaveEditor/refs/heads/main/repack.png">
<link rel="manifest" href="manifest.json">
<script type="application/ld+json">{ "@context":"https://schema.org", "@type":"WebApplication", "name":"RePack", "url":"https://re-pack-delta.vercel.app", "description":"Client-side Eaglercraft EPK save editor.", "applicationCategory":"DeveloperApplication", "operatingSystem":"All", "author":{"@type":"Person","name":"ayqshi","url":"https://github.com/ayqshi"}, "offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}
}</script>
<script src="https://cdn.tailwindcss.com"></script>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap"
rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body class="antialiased bg-black text-white">
<div id="loadingScreen">
<div class="loading-logo"><img
src="https://raw.githubusercontent.com/ayqshi/Eaglercraft-SaveEditor/refs/heads/main/repack.png"
alt="RePack"><span class="loading-logo-text">RePack</span></div>
<div class="loading-bar-track">
<div class="loading-bar-fill" id="loadingBar"></div>
</div><span class="loading-label" id="loadingLabel">Starting up...</span>
</div>
<div class="animate-fade-in app-shell">
<header class="app-header">
<div class="header-logo-container"><img width="32" height="32" style="border-radius:6px"
src="https://raw.githubusercontent.com/ayqshi/Eaglercraft-SaveEditor/refs/heads/main/repack.png"
alt="RePack">
<h1 class="app-title">RePack</h1>
</div>
<nav class="header-nav"><button class="header-nav-btn active" id="nav-home"
data-page="home">Home</button><button class="header-nav-btn" id="nav-editor"
data-page="editor">Editor</button><button class="header-nav-btn" id="nav-bookmarklet"
data-page="bookmarklet">Bookmarklet</button></nav><span class="cache-badge" id="cacheBadge"
title="Cached saves">no cache</span>
</header>
<div class="page active" id="page-home">
<div class="home-hero">
<div class="home-grid-bg"></div><span class="home-eyebrow">Eaglercraft Save Editor </span>
<h1 class="home-title">RePack</h1>
<p class="home-sub">Open any Eaglercraft world, tweak what you want, and export it back. Runs entirely
in your browser — nothing leaves your device.</p>
<div class="home-cta"><button class="btn btn-primary btn-large" onclick="showPage('editor')">Open
Editor</button><a class="btn btn-outline btn-large"
href="https://github.com/ayqshi/Eaglercraft-SaveEditor" target="_blank"
rel="noopener">GitHub</a></div>
<div class="home-features">
<div class="feature-card">
<div class="feature-icon"><img src="epk.png"></div>
<div class="feature-title">EPK Support</div>
<div class="feature-desc">Unpack and repack 1.5.2 and 1.8.8 Eaglercraft world saves. Version is
detected automatically.</div>
</div>
<div class="feature-card">
<div class="feature-icon"><img src="inveditor.png"></div>
<div class="feature-title">Full Inventory</div>
<div class="feature-desc">Edit all 36 slots plus all 4 armor slots. Add, remove, enchant, and
set durability on any item.</div>
</div>
<div class="feature-card">
<div class="feature-icon"><img src="worldeditor.png"></div>
<div class="feature-title">World Settings</div>
<div class="feature-desc">Change game mode, difficulty, time, weather, spawn point, seed, and
every gamerule.</div>
</div>
</div>
</div>
</div>
<div class="page" id="page-editor">
<main class="app-workspace">
<div class="workspace-column sidebar-column">
<section class="animate-slide-up app-card" style="animation-delay:50ms">
<div class="card-header">
<h2 class="section-header">Source</h2>
</div>
<p class="section-description">Load an EPK world save from your device.</p>
<div class="upload-area"><input id="epkFileInput" type="file" accept=".epk,.zip"
class="file-input"><label for="epkFileInput" class="file-input-label"><span
class="label-text">Choose EPK File</span><span class="label-subtext">.epk ·
.zip</span></label></div>
<div class="source-info-row"><span class="label">File</span><span class="value text-highlight"
id="epkName">None</span></div>
<div class="source-info-row"><span class="label">Version</span><span
class="value text-highlight" id="detectedVersionDisplay">—</span></div><button
class="btn btn-primary w-full" id="decompileButton" disabled>Unpack</button>
<div class="status-message" id="statusMessage"></div>
</section>
<section class="animate-slide-up app-card" style="animation-delay:.1s">
<div class="card-header" style="justify-content:space-between">
<h2 class="section-header">Files</h2>
<div style="display:flex;gap:6px"><button class="btn btn-outline btn-sm"
id="addFileButton">Add</button><button class="btn btn-outline btn-sm btn-danger"
id="removeFileButton" disabled>Remove</button></div>
</div>
<div class="custom-scroll file-list-viewport" id="fileList">
<p class="empty-directory-text">Load an EPK to get started.</p>
</div>
</section>
</div>
<div class="workspace-column main-editor-column">
<section class="animate-slide-up app-card"
style="animation-delay:.15s;display:flex;flex-direction:column;gap:14px">
<div class="card-header" style="justify-content:space-between;flex-wrap:wrap;gap:8px">
<h2 class="section-header">Editor</h2>
<div class="active-file-indicator"><span
class="mr-1 text-secondary text-xs">File:</span><span class="value font-mono"
id="activeFileNameDisplay">None</span></div>
</div>
<div class="editor-viewport-container" style="flex:1;min-height:320px"><textarea
class="custom-scroll text-editor-field" disabled id="fileContentEditor"
placeholder="Open a file from the list on the left."></textarea>
<div class="hidden-by-default" id="moddingMenuContainer" style="overflow-y:auto;flex:1">
</div>
</div>
<div class="editor-actions"><button class="btn btn-primary w-full" id="saveChangesButton"
disabled>Save Changes</button></div>
</section>
<section class="animate-slide-up app-card" style="animation-delay:.2s">
<div class="card-header">
<h2 class="section-header">Export</h2>
</div>
<p class="section-description">Pack all changes back into an EPK file and download it.</p>
<button class="btn btn-primary w-full btn-large" id="repackButton" disabled>Download
EPK</button>
</section>
</div>
</main>
</div>
<div class="page" id="page-bookmarklet">
<div style="max-width:720px;margin:0 auto;padding:40px 24px;display:flex;flex-direction:column;gap:24px">
<div>
<h2 style="font-size:1.4rem;font-weight:700;color:var(--white);margin-bottom:8px">Bookmarklet</h2>
<p style="font-size:0.85rem;color:var(--g400);line-height:1.7"> These browser bookmarks let you grab
EPK files straight from an Eaglercraft page and open them here automatically — no manual
download needed. </p>
</div>
<div class="app-card">
<div class="card-header">
<h3 class="section-header" style="font-size:0.95rem">EPK Scraper</h3>
</div>
<p class="section-description">Drag this to your bookmarks bar. Click it on any Eaglercraft 1.12.2
client page to extract the world EPK and open it here.</p>
<div style="background:var(--g900);border:1px solid var(--g800);border-radius:var(--r-sm);padding:14px;font-family:var(--font-mono);font-size:0.75rem;color:var(--g300);word-break:break-all;line-height:1.6"
id="scraperCode"></div>
<div style="display:flex;gap:8px;margin-top:4px"><a id="scraperLink" disabled
class="btn btn-outline btn-sm" href="#" onclick="return false;"
title="Drag me to your bookmarks bar">coming soon.</a><button class="btn btn-outline btn-sm"
onclick="navigator.clipboard.writeText(document.getElementById('scraperCode').textContent).then(()=>showStatusGlobal('Copied.','success'))">Copy</button>
</div>
</div>
<div class="app-card" style="border-color:var(--g700)">
<div class="card-header">
<h3 class="section-header" style="font-size:0.95rem">Live In-Game Edit (Experimental)</h3>
</div>
<p class="section-description" style="line-height:1.8"> The idea: inject a bookmarklet on an active
Eaglercraft tab that reads the cached/IndexedDB world data while you're in-game, sends it to
RePack, and writes edits back. </p>
<div style="background:var(--g900);border:1px solid var(--g800);border-radius:var(--r-sm);padding:14px;font-family:var(--font-mono);font-size:0.75rem;color:var(--g300);word-break:break-all;line-height:1.6"
id="liveEditCode"></div>
<div style="display:flex;gap:8px;margin-top:4px"><a id="liveEditLink" disabled
class="btn btn-outline btn-sm" href="#" onclick="return false;">coming soon.</a><button
class="btn btn-outline btn-sm"
onclick="navigator.clipboard.writeText(document.getElementById('liveEditCode').textContent).then(()=>showStatusGlobal('Copied.','success'))">Copy</button>
</div>
</div>
</div>
</div>
<footer class="app-footer">
<div class="footer-wrap"><span class="legal-disclaimer">All processing is local. Nothing is uploaded
anywhere.</span><span class="dev-credits">by <a class="link-mono" href="https://github.com/ayqshi"
rel="noopener noreferrer" target="_blank">ayqshi</a></span></div>
</footer>
</div>
<div class="modal-backdrop" id="messageBox">
<div class="modal-card">
<div class="modal-decor"></div>
<h3 class="modal-title" id="messageTitle">Notice</h3>
<p class="modal-body" id="messageContent"></p>
<div class="modal-actions"><button class="btn btn-primary w-full" id="messageCloseBtn">OK</button></div>
</div>
</div>
<div class="modal-backdrop" id="promptBox">
<div class="modal-card">
<div class="modal-decor"></div>
<h3 class="modal-title" id="promptTitle">Input</h3>
<p class="modal-body" id="promptBody"></p><input class="modal-input" id="promptInput" type="text">
<div class="modal-actions"><button class="btn btn-outline w-full" id="promptCancel">Cancel</button><button
class="btn btn-primary w-full" id="promptOk">OK</button></div>
</div>
</div>
<div class="modal-backdrop" id="confirmBox">
<div class="modal-card">
<div class="modal-decor"></div>
<h3 class="modal-title" id="confirmTitle">Are you sure?</h3>
<p class="modal-body" id="confirmBody"></p>
<div class="modal-actions"><button class="btn btn-outline w-full" id="confirmCancel">Cancel</button><button
class="btn btn-primary w-full" id="confirmOk">Confirm</button></div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/long@5.2.0/umd/index.min.js"></script>
<script src="powernbt.js"></script>
<script src="nbt.js"></script>
<script src="main.js"></script>
<script>function showStatusGlobal(e, t) { "function" == typeof window.showStatus && window.showStatus(e, t) } document.addEventListener("DOMContentLoaded", () => { const e = "javascript:" + encodeURIComponent(liveEditFn); document.getElementById("liveEditCode").textContent = liveEditFn; const t = document.getElementById("liveEditLink"); t.href = e, t.setAttribute("draggable", "true"); window._onVersionDetected; const n = document.getElementById("detectedVersionDisplay"); Object.defineProperty(window, "detectedVersion", { get() { return this._dv }, set(e) { this._dv = e, n && (n.textContent = e || "—") }, configurable: !0 }); const o = document.getElementById("messageCloseBtn"); o && o.addEventListener("click", () => { document.getElementById("messageBox").classList.remove("show") }) });
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because one or more lines are too long
+674
View File
@@ -0,0 +1,674 @@
/*
NBT.js - a JavaScript parser for NBT archives
by Sijmen Mulder
I, the copyright holder of this work, hereby release it into the public
domain. This applies worldwide.
In case this is not legally possible: I grant anyone the right to use this
work for any purpose, without any conditions, unless such conditions are
required by law.
*/
(function() {
'use strict';
if (typeof ArrayBuffer === 'undefined') {
throw new Error('Missing required type ArrayBuffer');
}
if (typeof DataView === 'undefined') {
throw new Error('Missing required type DataView');
}
if (typeof Uint8Array === 'undefined') {
throw new Error('Missing required type Uint8Array');
}
/** @exports nbt */
var nbt = this;
var zlib = typeof require !== 'undefined' ? require('zlib') : window.zlib;
/**
* A mapping from type names to NBT type numbers.
* {@link module:nbt.Writer} and {@link module:nbt.Reader}
* have correspoding methods (e.g. {@link module:nbt.Writer#int})
* for every type.
*
* @type Object<string, number>
* @see module:nbt.tagTypeNames */
nbt.tagTypes = {
'end': 0,
'byte': 1,
'short': 2,
'int': 3,
'long': 4,
'float': 5,
'double': 6,
'byteArray': 7,
'string': 8,
'list': 9,
'compound': 10,
'intArray': 11,
'longArray': 12
};
/**
* A mapping from NBT type numbers to type names.
*
* @type Object<number, string>
* @see module:nbt.tagTypes */
nbt.tagTypeNames = {};
(function() {
for (var typeName in nbt.tagTypes) {
if (nbt.tagTypes.hasOwnProperty(typeName)) {
nbt.tagTypeNames[nbt.tagTypes[typeName]] = typeName;
}
}
})();
function hasGzipHeader(data) {
var head = new Uint8Array(data.slice(0, 2));
return head.length === 2 && head[0] === 0x1f && head[1] === 0x8b;
}
function encodeUTF8(str) {
var array = [], i, c;
for (i = 0; i < str.length; i++) {
c = str.charCodeAt(i);
if (c < 0x80) {
array.push(c);
} else if (c < 0x800) {
array.push(0xC0 | c >> 6);
array.push(0x80 | c & 0x3F);
} else if (c < 0x10000) {
array.push(0xE0 | c >> 12);
array.push(0x80 | (c >> 6) & 0x3F);
array.push(0x80 | c & 0x3F);
} else {
array.push(0xF0 | (c >> 18) & 0x07);
array.push(0x80 | (c >> 12) & 0x3F);
array.push(0x80 | (c >> 6) & 0x3F);
array.push(0x80 | c & 0x3F);
}
}
return array;
}
function decodeUTF8(array) {
var codepoints = [], i;
for (i = 0; i < array.length; i++) {
if ((array[i] & 0x80) === 0) {
codepoints.push(array[i] & 0x7F);
} else if (i+1 < array.length &&
(array[i] & 0xE0) === 0xC0 &&
(array[i+1] & 0xC0) === 0x80) {
codepoints.push(
((array[i] & 0x1F) << 6) |
( array[i+1] & 0x3F));
} else if (i+2 < array.length &&
(array[i] & 0xF0) === 0xE0 &&
(array[i+1] & 0xC0) === 0x80 &&
(array[i+2] & 0xC0) === 0x80) {
codepoints.push(
((array[i] & 0x0F) << 12) |
((array[i+1] & 0x3F) << 6) |
( array[i+2] & 0x3F));
} else if (i+3 < array.length &&
(array[i] & 0xF8) === 0xF0 &&
(array[i+1] & 0xC0) === 0x80 &&
(array[i+2] & 0xC0) === 0x80 &&
(array[i+3] & 0xC0) === 0x80) {
codepoints.push(
((array[i] & 0x07) << 18) |
((array[i+1] & 0x3F) << 12) |
((array[i+2] & 0x3F) << 6) |
( array[i+3] & 0x3F));
}
}
return String.fromCharCode.apply(null, codepoints);
}
/* Not all environments, in particular PhantomJS, supply
Uint8Array.slice() */
function sliceUint8Array(array, begin, end) {
if ('slice' in array) {
return array.slice(begin, end);
} else {
return new Uint8Array([].slice.call(array, begin, end));
}
}
/**
* In addition to the named writing methods documented below,
* the same methods are indexed by the NBT type number as well,
* as shown in the example below.
*
* @constructor
* @see module:nbt.Reader
*
* @example
* var writer = new nbt.Writer();
*
* // all equivalent
* writer.int(42);
* writer[3](42);
* writer(nbt.tagTypes.int)(42);
*
* // overwrite the second int
* writer.offset = 0;
* writer.int(999);
*
* return writer.buffer; */
nbt.Writer = function() {
var self = this;
/* Will be resized (x2) on write if necessary. */
var buffer = new ArrayBuffer(1024);
/* These are recreated when the buffer is */
var dataView = new DataView(buffer);
var arrayView = new Uint8Array(buffer);
/**
* The location in the buffer where bytes are written or read.
* This increases after every write, but can be freely changed.
* The buffer will be resized when necessary.
*
* @type number */
this.offset = 0;
// Ensures that the buffer is large enough to write `size` bytes
// at the current `self.offset`.
function accommodate(size) {
var requiredLength = self.offset + size;
if (buffer.byteLength >= requiredLength) {
return;
}
var newLength = buffer.byteLength;
while (newLength < requiredLength) {
newLength *= 2;
}
var newBuffer = new ArrayBuffer(newLength);
var newArrayView = new Uint8Array(newBuffer);
newArrayView.set(arrayView);
// If there's a gap between the end of the old buffer
// and the start of the new one, we need to zero it out
if (self.offset > buffer.byteLength) {
newArrayView.fill(0, buffer.byteLength, self.offset);
}
buffer = newBuffer;
dataView = new DataView(newBuffer);
arrayView = newArrayView;
}
function write(dataType, size, value) {
accommodate(size);
dataView['set' + dataType](self.offset, value);
self.offset += size;
return self;
}
/**
* Returns the writen data as a slice from the internal buffer,
* cutting off any padding at the end.
*
* @returns {ArrayBuffer} a [0, offset] slice of the interal buffer */
this.getData = function() {
accommodate(0); /* make sure the offset is inside the buffer */
return buffer.slice(0, self.offset);
};
/**
* @method module:nbt.Writer#byte
* @param {number} value - a signed byte
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.byte] = write.bind(this, 'Int8', 1);
/**
* @method module:nbt.Writer#ubyte
* @param {number} value - an unsigned byte
* @returns {module:nbt.Writer} itself */
this.ubyte = write.bind(this, 'Uint8', 1);
/**
* @method module:nbt.Writer#short
* @param {number} value - a signed 16-bit integer
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.short] = write.bind(this, 'Int16', 2);
/**
* @method module:nbt.Writer#int
* @param {number} value - a signed 32-bit integer
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.int] = write.bind(this, 'Int32', 4);
/**
* @method module:nbt.Writer#float
* @param {number} value - a signed 32-bit float
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.float] = write.bind(this, 'Float32', 4);
/**
* @method module:nbt.Writer#float
* @param {number} value - a signed 64-bit float
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.double] = write.bind(this, 'Float64', 8);
/**
* As JavaScript does not support 64-bit integers natively, this
* method takes an array of two 32-bit integers that make up the
* upper and lower halves of the long.
*
* @method module:nbt.Writer#long
* @param {Array.<number>} value - [upper, lower]
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.long] = function(value) {
self.int(value[0]);
self.int(value[1]);
return self;
};
/**
* @method module:nbt.Writer#byteArray
* @param {Array.<number>|Uint8Array|Buffer} value
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.byteArray] = function(value) {
this.int(value.length);
accommodate(value.length);
arrayView.set(value, this.offset);
this.offset += value.length;
return this;
};
/**
* @method module:nbt.Writer#intArray
* @param {Array.<number>} value
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.intArray] = function(value) {
this.int(value.length);
var i;
for (i = 0; i < value.length; i++) {
this.int(value[i]);
}
return this;
};
/**
* @method module:nbt.Writer#longArray
* @param {Array.<number>} value
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.longArray] = function(value) {
this.int(value.length);
var i;
for (i = 0; i < value.length; i++) {
this.long(value[i]);
}
return this;
};
/**
* @method module:nbt.Writer#string
* @param {string} value
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.string] = function(value) {
var bytes = encodeUTF8(value);
this.short(bytes.length);
accommodate(bytes.length);
arrayView.set(bytes, this.offset);
this.offset += bytes.length;
return this;
};
/**
* @method module:nbt.Writer#list
* @param {Object} value
* @param {number} value.type - the NBT type number
* @param {Array} value.value - an array of values
* @returns {module:nbt.Writer} itself */
this[nbt.tagTypes.list] = function(value) {
this.byte(nbt.tagTypes[value.type]);
this.int(value.value.length);
var i;
for (i = 0; i < value.value.length; i++) {
this[value.type](value.value[i]);
}
return this;
};
/**
* @method module:nbt.Writer#compound
* @param {Object} value - a key/value map
* @param {Object} value.KEY
* @param {string} value.KEY.type - the NBT type number
* @param {Object} value.KEY.value - a value matching the type
* @returns {module:nbt.Writer} itself
*
* @example
* writer.compound({
* foo: { type: 'int', value: 12 },
* bar: { type: 'string', value: 'Hello, World!' }
* }); */
this[nbt.tagTypes.compound] = function(value) {
var self = this;
Object.keys(value).map(function (key) {
self.byte(nbt.tagTypes[value[key].type]);
self.string(key);
self[value[key].type](value[key].value);
});
this.byte(nbt.tagTypes.end);
return this;
};
var typeName;
for (typeName in nbt.tagTypes) {
if (nbt.tagTypes.hasOwnProperty(typeName)) {
this[typeName] = this[nbt.tagTypes[typeName]];
}
}
};
/**
* In addition to the named writing methods documented below,
* the same methods are indexed by the NBT type number as well,
* as shown in the example below.
*
* @constructor
* @see module:nbt.Writer
*
* @example
* var reader = new nbt.Reader(buf);
* int x = reader.int();
* int y = reader[3]();
* int z = reader[nbt.tagTypes.int](); */
nbt.Reader = function(buffer) {
if (!buffer) { throw new Error('Argument "buffer" is falsy'); }
var self = this;
/**
* The current location in the buffer. Can be freely changed
* within the bounds of the buffer.
*
* @type number */
this.offset = 0;
var arrayView = new Uint8Array(buffer);
var dataView = new DataView(arrayView.buffer);
function read(dataType, size) {
var val = dataView['get' + dataType](self.offset);
self.offset += size;
return val;
}
/**
* @method module:nbt.Reader#byte
* @returns {number} the read byte */
this[nbt.tagTypes.byte] = read.bind(this, 'Int8', 1);
/**
* @method module:nbt.Reader#byte
* @returns {number} the read unsigned byte */
this.ubyte = read.bind(this, 'Uint8', 1);
/**
* @method module:nbt.Reader#short
* @returns {number} the read signed 16-bit short */
this[nbt.tagTypes.short] = read.bind(this, 'Int16', 2);
/**
* @method module:nbt.Reader#int
* @returns {number} the read signed 32-bit integer */
this[nbt.tagTypes.int] = read.bind(this, 'Int32', 4);
/**
* @method module:nbt.Reader#float
* @returns {number} the read signed 32-bit float */
this[nbt.tagTypes.float] = read.bind(this, 'Float32', 4);
/**
* @method module:nbt.Reader#double
* @returns {number} the read signed 64-bit float */
this[nbt.tagTypes.double] = read.bind(this, 'Float64', 8);
/**
* As JavaScript does not not natively support 64-bit
* integers, the value is returned as an array of two
* 32-bit integers, the upper and the lower.
*
* @method module:nbt.Reader#long
* @returns {Array.<number>} [upper, lower] */
this[nbt.tagTypes.long] = function() {
return [this.int(), this.int()];
};
/**
* @method module:nbt.Reader#byteArray
* @returns {Array.<number>} the read array */
this[nbt.tagTypes.byteArray] = function() {
var length = this.int();
var bytes = [];
var i;
for (i = 0; i < length; i++) {
bytes.push(this.byte());
}
return bytes;
};
/**
* @method module:nbt.Reader#intArray
* @returns {Array.<number>} the read array of 32-bit ints */
this[nbt.tagTypes.intArray] = function() {
var length = this.int();
var ints = [];
var i;
for (i = 0; i < length; i++) {
ints.push(this.int());
}
return ints;
};
/**
* As JavaScript does not not natively support 64-bit
* integers, the value is returned as an array of arrays of two
* 32-bit integers, the upper and the lower.
*
* @method module:nbt.Reader#longArray
* @returns {Array.<number>} the read array of 64-bit ints
* split into [upper, lower] */
this[nbt.tagTypes.longArray] = function() {
var length = this.int();
var longs = [];
var i;
for (i = 0; i < length; i++) {
longs.push(this.long());
}
return longs;
};
/**
* @method module:nbt.Reader#string
* @returns {string} the read string */
this[nbt.tagTypes.string] = function() {
var length = this.short();
var slice = sliceUint8Array(arrayView, this.offset,
this.offset + length);
this.offset += length;
return decodeUTF8(slice);
};
/**
* @method module:nbt.Reader#list
* @returns {{type: string, value: Array}}
*
* @example
* reader.list();
* // -> { type: 'string', values: ['foo', 'bar'] } */
this[nbt.tagTypes.list] = function() {
var type = this.byte();
var length = this.int();
var values = [];
var i;
for (i = 0; i < length; i++) {
values.push(this[type]());
}
return { type: nbt.tagTypeNames[type], value: values };
};
/**
* @method module:nbt.Reader#compound
* @returns {Object.<string, { type: string, value }>}
*
* @example
* reader.compound();
* // -> { foo: { type: int, value: 42 },
* // bar: { type: string, value: 'Hello! }} */
this[nbt.tagTypes.compound] = function() {
var values = {};
while (true) {
var type = this.byte();
if (type === nbt.tagTypes.end) {
break;
}
var name = this.string();
var value = this[type]();
values[name] = { type: nbt.tagTypeNames[type], value: value };
}
return values;
};
var typeName;
for (typeName in nbt.tagTypes) {
if (nbt.tagTypes.hasOwnProperty(typeName)) {
this[typeName] = this[nbt.tagTypes[typeName]];
}
}
};
/**
* @param {Object} value - a named compound
* @param {string} value.name - the top-level name
* @param {Object} value.value - a compound
* @returns {ArrayBuffer}
*
* @see module:nbt.parseUncompressed
* @see module:nbt.Writer#compound
*
* @example
* nbt.writeUncompressed({
* name: 'My Level',
* value: {
* foo: { type: int, value: 42 },
* bar: { type: string, value: 'Hi!' }
* }
* }); */
nbt.writeUncompressed = function(value) {
if (!value) { throw new Error('Argument "value" is falsy'); }
var writer = new nbt.Writer();
writer.byte(nbt.tagTypes.compound);
writer.string(value.name);
writer.compound(value.value);
return writer.getData();
};
/**
* @param {ArrayBuffer|Buffer} data - an uncompressed NBT archive
* @returns {{name: string, value: Object.<string, Object>}}
* a named compound
*
* @see module:nbt.parse
* @see module:nbt.writeUncompressed
*
* @example
* nbt.readUncompressed(buf);
* // -> { name: 'My Level',
* // value: { foo: { type: int, value: 42 },
* // bar: { type: string, value: 'Hi!' }}} */
nbt.parseUncompressed = function(data) {
if (!data) { throw new Error('Argument "data" is falsy'); }
var reader = new nbt.Reader(data);
var type = reader.byte();
if (type !== nbt.tagTypes.compound) {
throw new Error('Top tag should be a compound');
}
return {
name: reader.string(),
value: reader.compound()
};
};
/**
* @callback parseCallback
* @param {Object} error
* @param {Object} result - a named compound
* @param {string} result.name - the top-level name
* @param {Object} result.value - the top-level compound */
/**
* This accepts both gzipped and uncompressd NBT archives.
* If the archive is uncompressed, the callback will be
* called directly from this method. For gzipped files, the
* callback is async.
*
* For use in the browser, window.zlib must be defined to decode
* compressed archives. It will be passed a Buffer if the type is
* available, or an Uint8Array otherwise.
*
* @param {ArrayBuffer|Buffer} data - gzipped or uncompressed data
* @param {parseCallback} callback
*
* @see module:nbt.parseUncompressed
* @see module:nbt.Reader#compound
*
* @example
* nbt.parse(buf, function(error, results) {
* if (error) {
* throw error;
* }
* console.log(result.name);
* console.log(result.value.foo);
* }); */
nbt.parse = function(data, callback) {
if (!data) { throw new Error('Argument "data" is falsy'); }
var self = this;
if (!hasGzipHeader(data)) {
callback(null, self.parseUncompressed(data));
} else if (!zlib) {
callback(new Error('NBT archive is compressed but zlib is not ' +
'available'), null);
} else {
/* zlib.gunzip take a Buffer, at least in Node, so try to convert
if possible. */
var buffer;
if (data.length) {
buffer = data;
} else if (typeof Buffer !== 'undefined') {
buffer = new Buffer(data);
} else {
/* In the browser? Unknown zlib library. Let's settle for
Uint8Array and see what happens. */
buffer = new Uint8Array(data);
}
zlib.gunzip(buffer, function(error, uncompressed) {
if (error) {
callback(error, null);
} else {
callback(null, self.parseUncompressed(uncompressed));
}
});
}
};
}).apply(typeof exports !== 'undefined' ? exports : (window.nbt = {}));
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 581 KiB

File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB