当前位置: 首页>>代码示例>>Java>>正文


Java Region.getMaximumPoint方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.regions.Region.getMaximumPoint方法的典型用法代码示例。如果您正苦于以下问题:Java Region.getMaximumPoint方法的具体用法?Java Region.getMaximumPoint怎么用?Java Region.getMaximumPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.regions.Region的用法示例。


在下文中一共展示了Region.getMaximumPoint方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeLayers

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
@Command(
        aliases = {"removelayers"},
        usage = "<id>",
        desc = "Removes matching chunk layers",
        help = "Remove if all the selected layers in a chunk match the provided id"
)
@CommandPermissions("worldedit.anvil.removelayer")
public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException {
    Vector min = selection.getMinimumPoint();
    Vector max = selection.getMaximumPoint();
    int minY = min.getBlockY();
    int maxY = max.getBlockY();
    RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
    MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
    if (result != null) {
        player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal()));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:AnvilCommands.java

示例2: canBypassAll

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public boolean canBypassAll(Region region, boolean get, boolean set) {
    if (wrapped) return false;
    FaweRegionExtent regionExtent = getRegionExtent();
    if (!(region instanceof CuboidRegion)) return false;
    if (regionExtent != null) {
        if (!(region instanceof CuboidRegion)) return false;
        Vector pos1 = region.getMinimumPoint();
        Vector pos2 = region.getMaximumPoint();
        boolean contains = false;
        for (RegionWrapper current : regionExtent.getRegions()) {
            if (current.isIn((int) pos1.getX(), pos1.getBlockY(), pos1.getBlockZ()) && current.isIn(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ())) {
                contains = true;
                break;
            }
        }
        if (!contains) return false;
    }
    long area = region.getArea();
    FaweLimit left = getLimitLeft();
    if (!left.isUnlimited() && (((get || getChangeTask() != null) && left.MAX_CHECKS <= area) || (set && left.MAX_CHANGES <= area)))
        return false;
    if (getChangeTask() != getChangeSet()) return false;
    if (!Masks.isNull(getMask()) || !Masks.isNull(getSourceMask())) return false;
    if (getBlockBag() != null) return false;
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:EditSession.java

示例3: ArbitraryShape

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public ArbitraryShape(Region extent) {
    this.extent = extent;

    Vector min = extent.getMinimumPoint();
    Vector max = extent.getMaximumPoint();

    cacheOffsetX = min.getBlockX() - 1;
    cacheOffsetY = min.getBlockY() - 1;
    cacheOffsetZ = min.getBlockZ() - 1;

    cacheSizeX = (int) (max.getX() - cacheOffsetX + 2);
    cacheSizeY = (int) (max.getY() - cacheOffsetY + 2);
    cacheSizeZ = (int) (max.getZ() - cacheOffsetZ + 2);

    cache = new short[cacheSizeX * cacheSizeY * cacheSizeZ];
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:ArbitraryShape.java

示例4: fixLighting

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
/**
 * Fix the lighting in a selection<br>
 * - First removes all lighting, then relights
 * - Relights in parallel (if enabled) for best performance<br>
 * - Also resends chunks<br>
 *
 * @param world
 * @param selection (assumes cuboid)
 * @return
 */
public static int fixLighting(World world, Region selection, @Nullable FaweQueue queue, final FaweQueue.RelightMode mode) {
    final Vector bot = selection.getMinimumPoint();
    final Vector top = selection.getMaximumPoint();

    final int minX = bot.getBlockX() >> 4;
    final int minZ = bot.getBlockZ() >> 4;

    final int maxX = top.getBlockX() >> 4;
    final int maxZ = top.getBlockZ() >> 4;

    int count = 0;
    if (queue == null) {
        queue = SetQueue.IMP.getNewQueue(world, true, false);
    }
    // Remove existing lighting first
    if (queue instanceof NMSMappedFaweQueue) {
        final NMSMappedFaweQueue nmsQueue = (NMSMappedFaweQueue) queue;
        NMSRelighter relighter = new NMSRelighter(nmsQueue);
        for (int x = minX; x <= maxX; x++) {
            for (int z = minZ; z <= maxZ; z++) {
                relighter.addChunk(x, z, null, 65535);
                count++;
            }
        }
        if (mode != FaweQueue.RelightMode.NONE) {
            boolean sky = nmsQueue.hasSky();
            if (sky) {
                relighter.fixSkyLighting();
            }
            relighter.fixBlockLighting();
        } else {
            relighter.removeLighting();
        }
        relighter.sendChunks();
    }
    return count;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:48,代码来源:FaweAPI.java

示例5: checkConfirmationStack

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public void checkConfirmationStack(String command, Region region, int times) throws RegionOperationException {
    if (command == null || getMeta("cmdConfirmRunning", false)) {
        return;
    }
    if (region != null) {
        Vector min = region.getMinimumPoint();
        Vector max = region.getMaximumPoint();
        long area = (long) ((max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1)) * times;
        if (area > 2 << 18) {
            setMeta("cmdConfirm", command);
            throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(min, max, command));
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:15,代码来源:FawePlayer.java

示例6: checkConfirmationRegion

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public void checkConfirmationRegion(String command, Region region) throws RegionOperationException {
    if (command == null || getMeta("cmdConfirmRunning", false)) {
        return;
    }
    if (region != null) {
        Vector min = region.getMinimumPoint();
        Vector max = region.getMaximumPoint();
        long area = (long) ((max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1));
        if (area > 2 << 18) {
            setMeta("cmdConfirm", command);
            throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(min, max, command));
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:15,代码来源:FawePlayer.java

示例7: CylinderRegionSelector

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
/**
 * Create a new selector from the given one.
 *
 * @param oldSelector the old selector
 */
public CylinderRegionSelector(RegionSelector oldSelector) {
    this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());

    if (oldSelector instanceof CylinderRegionSelector) {
        final CylinderRegionSelector cylSelector = (CylinderRegionSelector) oldSelector;

        region = new CylinderRegion(cylSelector.region);
    } else {
        final Region oldRegion;
        try {
            oldRegion = oldSelector.getRegion();
        } catch (IncompleteRegionException e) {
            return;
        }

        Vector pos1 = oldRegion.getMinimumPoint();
        Vector pos2 = oldRegion.getMaximumPoint();

        Vector center = pos1.add(pos2).divide(2).floor();
        region.setCenter(center.toVector2D());
        region.setRadius(pos2.toVector2D().subtract(center.toVector2D()));

        region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY()));
        region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY()));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:CylinderRegionSelector.java

示例8: selection

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
@Command(
        aliases = {"clear", "unset"},
        desc = "Clear the chunks in a selection (delete without defrag)"
)
@CommandPermissions("worldedit.anvil.clear")
public void unset(Player player, EditSession editSession, @Selection Region selection) throws WorldEditException {
    Vector bot = selection.getMinimumPoint();
    Vector top = selection.getMaximumPoint();
    RegionWrapper region = new RegionWrapper(bot, top);

    MCAFilterCounter filter = new MCAFilterCounter() {
        @Override
        public MCAFile applyFile(MCAFile file) {
            int X = file.getX();
            int Z = file.getZ();
            int bcx = X << 5;
            int bcz = Z << 5;
            int bx = X << 9;
            int bz = Z << 9;
            if (region.isIn(bx, bz) && region.isIn(bx + 511, bz + 511)) {
                file.setDeleted(true);
                get().add(512 * 512 * 256);
            } else if (region.isInMCA(X, Z)) {
                file.init();
                final byte[] empty = new byte[4];
                RandomAccessFile raf = file.getRandomAccessFile();
                file.forEachChunk(new RunnableVal4<Integer, Integer, Integer, Integer>() {
                    @Override
                    public void run(Integer cx, Integer cz, Integer offset, Integer size) {
                        if (region.isInChunk(bcx + cx, bcz + cz)) {
                            int index = ((cx & 31) << 2) + ((cz & 31) << 7);
                            try {
                                raf.seek(index);
                                raf.write(empty);
                                get().add(16 * 16 * 256);
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                });
                file.clear();
            }
            return null;
        }
    };
    MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
    if (result != null) player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal()));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:50,代码来源:AnvilCommands.java

示例9: HeightMap

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
public HeightMap(EditSession session, Region region, boolean naturalOnly, boolean layers) {
    checkNotNull(session);
    checkNotNull(region);

    this.session = session;
    this.region = region;

    this.width = region.getWidth();
    this.height = region.getLength();

    this.layers = layers;

    int minX = region.getMinimumPoint().getBlockX();
    int minY = region.getMinimumPoint().getBlockY();
    int minZ = region.getMinimumPoint().getBlockZ();
    int maxY = region.getMaximumPoint().getBlockY();

    data = new int[width * height];
    invalid = new boolean[data.length];

    if (layers) {
        Vector min = region.getMinimumPoint();
        Vector max = region.getMaximumPoint();
        int bx = min.getBlockX();
        int bz = min.getBlockZ();
        Iterable<Vector2D> flat = Regions.asFlatRegion(region).asFlatRegion();
        Iterator<Vector2D> iter = new Fast2DIterator(flat, session).iterator();
        int y = 0;
        MutableBlockVector mutable = new MutableBlockVector();
        while (iter.hasNext()) {
            Vector2D pos = iter.next();
            int x = pos.getBlockX();
            int z = pos.getBlockZ();
            y = session.getNearestSurfaceLayer(x, z, y, 0, maxY);
            data[(z - bz) * width + (x - bx)] = y;
        }
    } else {
        // Store current heightmap data
        int index = 0;
        if (naturalOnly) {
            for (int z = 0; z < height; ++z) {
                for (int x = 0; x < width; ++x, index++) {
                    data[index] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY, naturalOnly);
                }
            }
        } else {
            int yTmp = 255;
            for (int z = 0; z < height; ++z) {
                for (int x = 0; x < width; ++x, index++) {
                    yTmp = session.getNearestSurfaceTerrainBlock(x + minX, z + minZ, yTmp, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
                    switch (yTmp) {
                        case Integer.MIN_VALUE:
                            yTmp = minY;
                            invalid[index] = true;
                            break;
                        case Integer.MAX_VALUE:
                            yTmp = maxY;
                            invalid[index] = true;
                            break;
                    }
                    data[index] = yTmp;
                }
            }
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:67,代码来源:HeightMap.java

示例10: getTransformedRegion

import com.sk89q.worldedit.regions.Region; //导入方法依赖的package包/类
/**
 * Get the transformed region.
 *
 * @return the transformed region
 */
public Region getTransformedRegion() {
    Region region = original.getRegion();
    Vector minimum = region.getMinimumPoint();
    Vector maximum = region.getMaximumPoint();

    Transform transformAround =
            new CombinedTransform(
                    new AffineTransform().translate(original.getOrigin().multiply(-1)),
                    transform,
                    new AffineTransform().translate(original.getOrigin()));

    // new Vector(minimum.getX(), minimum.getY(), minimum.getZ())
    // new Vector(maximum.getX(), maximum.getY(), maximum.getZ())
    Vector[] corners = new Vector[]{
            minimum,
            maximum,
            new Vector(maximum.getX(), minimum.getY(), minimum.getZ()),
            new Vector(minimum.getX(), maximum.getY(), minimum.getZ()),
            new Vector(minimum.getX(), minimum.getY(), maximum.getZ()),
            new Vector(minimum.getX(), maximum.getY(), maximum.getZ()),
            new Vector(maximum.getX(), minimum.getY(), maximum.getZ()),
            new Vector(maximum.getX(), maximum.getY(), minimum.getZ())};

    for (int i = 0; i < corners.length; i++) {
        corners[i] = transformAround.apply(new Vector(corners[i]));
    }

    Vector newMinimum = corners[0];
    Vector newMaximum = corners[0];

    for (int i = 1; i < corners.length; i++) {
        newMinimum = Vector.getMinimum(newMinimum, corners[i]);
        newMaximum = Vector.getMaximum(newMaximum, corners[i]);
    }

    // After transformation, the points may not really sit on a block,
    // so we should expand the region for edge cases
    newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX())));
    newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
    newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));

    return new CuboidRegion(newMinimum, newMaximum);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:49,代码来源:FlattenedClipboardTransform.java


注:本文中的com.sk89q.worldedit.regions.Region.getMaximumPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。