WorldEdit

WorldEdit

44M Downloads

Sponge Schematic 3 Reader requires BlockEntites tag under Blocks

PierreSchwang opened this issue ยท 1 comments

commented

WorldEdit Version

7.3.6+6892-3d660b8

Platform Version

Paper version 1.21.1-52-master@e08e667

Confirmations

  • I am using the most recent Minecraft release.
  • I am using a version of WorldEdit compatible with my Minecraft version.
  • I am using the latest or recommended version of my platform software.
  • I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
  • I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)

Bug Description

When trying to load a Sponge v3 Schematic where the Block Container does not contain any Block Entities and does not provide the BlockEntities tag WorldEdit throws a NoSuchElementException: java.util.NoSuchElementException: No tag under the name 'BlockEntities' exists.

The specification (https://github.com/SpongePowered/Schematic-Specification/blob/master/versions/schematic-3.md#-block-container) does not state, that the tag is required nor optional - but as the blocks inside the schematic do not necessarily require NBT data it should be treated as optional. The implementation by the Sponge team also treats the tag as optional:
https://github.com/SpongePowered/Sponge/blob/api-11/src/main/java/org/spongepowered/common/world/schematic/SchematicTranslator.java#L311
(comparing against L287, where an exception is thrown when a required tag is missing)

Expected Behavior

Schematics not containing any Block Entities and the associated tag should load without errors. An absent BlockEntities tag should be equal to an empty BlockEntities tag / LinListTag.

Reproduction Steps

  1. Attempt to load the attached schematic - not containing the BlockEntities tag: no-block-entities.zip
  2. Exception:
[02:17:02 ERROR]: Uncaught exception occurred in task: Loading schematic no-block-entities
java.util.NoSuchElementException: No tag under the name 'BlockEntities' exists
        at worldedit-bukkit-7.3.6.jar/org.enginehub.linbus.tree.LinCompoundTag.getTag(LinCompoundTag.java:380) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/org.enginehub.linbus.tree.LinCompoundTag.getListTag(LinCompoundTag.java:404) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader.decodeBlocksIntoClipboard(SpongeSchematicV3Reader.java:146) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader.readVersion3(SpongeSchematicV3Reader.java:121) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader.read(SpongeSchematicV3Reader.java:71) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/com.sk89q.worldedit.command.SchematicCommands$SchematicLoadTask.call(SchematicCommands.java:356) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/com.sk89q.worldedit.command.SchematicCommands$SchematicLoadTask.call(SchematicCommands.java:338) ~[worldedit-bukkit-7.3.6.jar:?]
        at worldedit-bukkit-7.3.6.jar/com.sk89q.worldedit.command.util.AsyncCommandBuilder.runTask(AsyncCommandBuilder.java:158) ~[worldedit-bukkit-7.3.6.jar:?]
        at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131) ~[guava-32.1.2-jre.jar:?]
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:75) ~[guava-32.1.2-jre.jar:?]
        at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82) ~[guava-32.1.2-jre.jar:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

Anything Else?

No response

commented

A PR to patch this would be welcome, as it should be a pretty simple change to make.