Amulet-Team / Amulet-Map-Editor

A new Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7.
https://www.amuletmc.com/
1.77k stars 123 forks source link

[Bug Report] Running Structure.paste() or Structure.set_version_block causes sea_pickles to become water source blocks #890

Open MSpaceDev opened 1 year ago

MSpaceDev commented 1 year ago

Bug Report

Current Behaviour:

When running Structure.paste() or Structure.set_version_block(), it causes sea_pickles to become water source blocks. When running the exact same paste() or or set_version_block on a World object, the sea_pickles are placed just fine.

Expected behavior:

When running Structure.paste() or Structure.set_version_block(), the sea_pickles should stay exactly the same, just like it does when pasting into a World.

Steps To Reproduce:

  1. Download schematic to test. (java_schematic.zip)
  2. Run this code:

        schematic = amulet.load_level("path/to/schematic.schem")
    
        bounds = schematic.bounds("main")
        x_size = bounds.max[0] - bounds.min[0]
        y_size = bounds.max[1] - bounds.min[1]
        z_size = bounds.max[2] - bounds.min[2]
    
        # Create new mcstructure file with correct bounds
        mcstructure_dir = "path/to/structure.mcstructure"
        mcstructure_wrapper = MCStructureFormatWrapper(mcstructure_dir)
        mcstructure_wrapper.create_and_open("bedrock", (1, 19, 73), SelectionGroup(SelectionBox((0, 0, 0), (x_size, y_size, z_size))), True)
        mcstructure_wrapper.save()
        mcstructure_wrapper.close()
    
        # Paste the schematic in the mcstructure
        paste_pos = (x_size / 2, y_size / 2, z_size / 2)
        mcstructure_level = amulet.load_level(mcstructure_dir)
        mcstructure_level.paste(schematic, "main", bounds, "main", paste_pos)
        mcstructure_level.save()
        mcstructure_level.close()
  3. See that water sources are placed when loading the .mcstructure.
  4. Now load a World with amulet.load_level(), and run the exact same paste, notice that it pastes the sea pickles correctly.

Environment:

Additional context

Seems to only be happening on a Structure object. When using a World object; block conversion works 100%.

Attachments

Screenshots

image image image image

gentlegiantJGC commented 1 year ago

I can't reproduce this. I followed the steps and then pasted both the original structure and the new mcstructure into both a Java 1.20.2 and Bedrock 1.20.30 world and the sea pickles don't have any water. I used Amulet Map Editor to do the final pastes but it just calls the same code. Is there something I have missed?

MSpaceDev commented 10 months ago

Hey @gentlegiantJGC, pasting the .mcstructure with Amulet Map Editor vs. Structure Block in-game is not the same.

I just tested, using Amulet Map Editor, the sea pickless are not waterlogged when I load into the world. However, using a Structure Block in-game, the sea pickles are waterlogged.

Amulet Map Editor Paste: image

Structure Block Paste: image

gentlegiantJGC commented 10 months ago

Your original report does not mention that you are pasting in game. Is this a different issue?

MSpaceDev commented 10 months ago

Hey, @gentlegiantJGC. Apologies for the lack of clarity there. In my initial post I made the assumption that the .mcstructure will be pasted with a Structure Block in-game.

Our usecase is that we are creating mcstructures with Amulet from Java schematics. To then be placed by /structure load controlled by our players. Everything else about the issue is the same.

This is not so critical for us, we are able workaround it with a find/replace solution.

A bug that's really critical for us, cause we have 100s of structures that we need to process, is this 180 degree paste bug: https://github.com/Amulet-Team/Amulet-Core/issues/252

I was hoping you'd have a chance to check it out for us? Would love if I could pay extra for your time, as this is a blocker in a project of ours.

gentlegiantJGC commented 10 months ago

I will have another look over these issues.

We have a sponsor page through github https://github.com/sponsors/Amulet-Team

MSpaceDev commented 10 months ago

Thank you so much.

gentlegiantJGC commented 10 months ago

Spent a while debugging what was causing this. Java has waterlogged to store if there is water at the same location as the block Bedrock has a layer system to store two separate blocks at the same location. In this case however Bedrock uses a property to store if the sea pickle is waterlogged.

I don't know what the solution is on our end. A quick fix on your end is to find all sea_pickle blocks with dead_bit set to ByteTag(0) and set it to ByteTag(1)