FastAsyncWorldEdit icon indicating copy to clipboard operation
FastAsyncWorldEdit copied to clipboard

Fix region restrictions with methods non-overriden

Open Aurelien30000 opened this issue 1 year ago • 0 comments

Overview

Fixes https://github.com/IntellectualSites/fastasyncvoxelsniper/issues/195

Description

FAWE handles internally region restrictions through ExditSession. However, FAWE does not override methods correctlty with direct coordinates (x, y, z) in FaweRegionExtent. Thus, the block may be returned without any process of the region restriction extents.

Example:

ExtentTraverser<Extent> traverser = new ExtentTraverser<>(editSession.getExtent());
while (traverser != null && traverser.exists()) {
    Extent extent = traverser.get();
    if (extent instanceof SingleRegionExtent singleRegionExtent) {
        System.out.println(singleRegionExtent.getRegions().iterator().next().toString());

        // Polished andeside, inside plot.
        System.out.println(singleRegionExtent.getBlock(-3938, 64, 1571));
        System.out.println(singleRegionExtent.getBlock(BlockVector3.at(-3938, 64, 1571)));

        // Brick slab, the plot border.
        System.out.println(singleRegionExtent.getBlock(-3938, 65, 1570));
        System.out.println(singleRegionExtent.getBlock(BlockVector3.at(-3938, 65, 1570)));
    }
    traverser = traverser.next();
}
[21:19:44 INFO]: minecraft:polished_andesite
[21:19:44 INFO]: minecraft:polished_andesite
[21:19:44 INFO]: minecraft:brick_slab[type=bottom,waterlogged=false]
[21:19:44 INFO]: minecraft:air

Perhaps such a fix could be deployed to other extents that have the same issue.

Submitter Checklist

  • [x] Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • [x] Ensure that the pull request title represents the desired changelog entry.
  • [x] New public fields and methods are annotated with @since TODO.
  • [x] I read and followed the contribution guidelines.

Aurelien30000 avatar Sep 15 '22 19:09 Aurelien30000