WorldEdit

WorldEdit

43M Downloads

Boat is not copied when a villager is a passenger

lukalt opened this issue ยท 2 comments

commented

WorldEdit Version

Bukkit-Official(7.2.12+6240-87f4ae1)

Platform Version

git-Paper-237 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: 25cd3ee)

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 placing a villager inside a boat, copying a region containing both entities and pasting it to another location in the same world results in a loss of the boat. Only the villager will be pasted while the boat is omitted. If no passenger is in the boat, it will be copied correctly.

Expected Behavior

Both villager and boat should be copied and the villager should be attached to the boat.

Reproduction Steps

  1. Place a boat
  2. Place a villager next to the boat using a spawn egg and wait for it to enter the boat

image
4. Mark a region around the villager
5. Run //copy -e
6. Run //paste -e at another location
7.
image

Anything Else?

This can be reproduced when using the WorldEdit API as well. According to this debug output, the BOAT is returned in the entities in the bukkit world but not in the list of entities in the clipboard. The is running with default configuration and no other plugins.

        for (org.bukkit.entity.Entity entity : bukkitWorld.getEntities()) {
            if(element.isInside(entity.getLocation().getX(), entity.getLocation().getZ())) {
                System.out.println("Entity in world: " + entity.getType());
            }
        }
        List<Chunk> chunksWithTickets = ChunkHelper.ensureChunksLoaded(bukkitWorld, element);
        try (EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder().world(world).maxBlocks(-1).build()) {
            ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(
                    editSession, region, clipboard, region.getMinimumPoint()
            );
            forwardExtentCopy.setCopyingEntities(true);
            forwardExtentCopy.setRemovingEntities(true);
            try {
                Operations.complete(forwardExtentCopy);
            } catch (WorldEditException e) {
                logger.log(Level.WARNING, "Failed to create schematic of " + element, e);
            }
        } finally {
            ChunkHelper.removeTickets(chunksWithTickets);
        }
        for (Entity entity : clipboard.getEntities()) {
            System.out.println("Entity in clipboard: " + (entity.getState() == null ? null : entity.getState().getType()));
        }

This bug should not have occurred with Minecraft 1.17.1 however I was not able to test this myself.

commented

maybe related to #2179 but i (still) can't repro (in fact i dont even get the duplicated entity i did before so dunno)

if the boat isn't in the clipboard i suspect the boat is not in the region being copied. i would note that your code snippet is not checking inclusion in the y-axis, but no clue what region you're using etc so could be entirely user error here.

commented

@wizjany As indicated by my screenshots, the region covers 5 blocks upwards and 5 blocks downward so the boat should definitely be inside the region.

In my code snippet, the region spawns up from -64 y to 256 y. The Bukkit Entity of the Boat is also in the selected region.

I just confirmed that this problem also occurs with the latest dev build (Bukkit-Official(7.3.0-SNAPSHOT+6274-0b6dcb1)).