Skip to content

Dependency-free implementation#1

Open
OpenBagTwo wants to merge 11 commits into
Netherwhal:feature/fixes-144-mutf8from
OpenBagTwo:feature/fixes-144-mutf8
Open

Dependency-free implementation#1
OpenBagTwo wants to merge 11 commits into
Netherwhal:feature/fixes-144-mutf8from
OpenBagTwo:feature/fixes-144-mutf8

Conversation

@OpenBagTwo

Copy link
Copy Markdown

Hi @Netherwhal. First off: thanks for your PR. Your implementation beats the heck out of how I was planning on handling the MUTF8 issue.

I've taken your branch and done three things:

  1. Rebased it onto the current HEAD of twoolie's branch
  2. Addressed the concerns about keeping the code dependency-free in two ways:
    • Added @TkTech's pure-python MUTF8 implementation to the codebase
    • Made it so that if the mutf8 package is installed in the user's environment, that's the version the NBT library will use
  3. Bumped the version to 1.6.0

If all that meets with your approval, feel free to grab my branch (because I did the rebase, you won't be able to just merge the PR) and update your own PR.

Alternatively, if you'd prefer, I can make a new PR into twoolie's repo myself. Just let me know what you'd prefer.

Validation Performed

  • Loaded a region file for an area that has signs, banners and other entities named with "unicode" characters and experienced no encode / decode errors
    • Did this both with and without the mutf8 library installed separately into my environment
  • Successfully ran a script to display the front text of all signs in my world. Special characters rendered in IPython correctly.
Here's the script, for reference
from os import environ
from pathlib import Path

import mutf8  # checking if mutf8 is installed as a package
from nbt import nbt, region

save_folder = Path(environ["SAVE_PATH"])

for path in all_region_files:
    region_data = region.RegionFile(path)
    for chunk in region_data.iter_chunks():
        for entity in chunk["block_entities"]:
            if entity["id"].value != "minecraft:sign":
                continue
            print(
                "\n{}\n".format(
                    "\n".join([line.value[1:-1] for line in entity["front_text"][1]])
                )
            )

With output (excerpted)

===============
⛏ Ores & More ⛏
===============
🔻🔻🔻



Unstackable




^
Store
Compost
v


===============
🍔 Food 🍔
===============



===============
💡 Light 💡
===============


⬛⬛  
⬛⬛  
⬛  ⬛
⬛⬛  

Spongecade and others added 11 commits October 6, 2023 12:14
Update Minecraft wiki links to new domain
For data version 1343, the 'Blocks' key is needed. In
commit cd0133d the code was change to
no longer create an AnvilSection if there is no 'BlockStates' key.
Change this to also create an AnvilSection if there is a 'Blocks' key.
Fix support for Minecraft version 1.12.2 (data version 1343)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants