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


Java EditSession.getExtent方法代码示例

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


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

示例1: build

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public void build(EditSession editSession, Vector pos2, final Pattern pattern, double size) throws MaxChangedBlocksException {
    boolean visual = (editSession.getExtent() instanceof VisualExtent);
    if (pos1 == null || pos2.equals(pos1)) {
        if (!visual) {
            pos1 = pos2;
            BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), pos2);
        }
        return;
    }
    Vector vertex = getVertex(pos1, pos2, slack);
    List<Vector> nodes = Arrays.asList(pos1, vertex, pos2);
    editSession.drawSpline(pattern, nodes, 0, 0, 0, 10, size, !shell);
    if (!visual) {
        BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
        if (!select) {
            pos1 = null;
            return;
        } else {
            pos1 = pos2;
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:CatenaryBrush.java

示例2: build

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public void build(EditSession editSession, Vector position, final Pattern pattern, double size) throws MaxChangedBlocksException {
    boolean visual = (editSession.getExtent() instanceof VisualExtent);
    if (pos1 == null) {
        if (!visual) {
            pos1 = position;
            BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), position);
        }
        return;
    }
    editSession.drawLine(pattern, pos1, position, size, !shell, flat);
    if (!visual) {
        BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
        if (!select) {
            pos1 = null;
            return;
        } else {
            pos1 = position;
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:LineBrush.java

示例3: build

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public void build(EditSession editSession, Vector pos, Pattern pattern, double radius) throws MaxChangedBlocksException {
    int maxY = editSession.getMaxY();
    boolean vis = editSession.getExtent() instanceof VisualExtent;
    if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) {
        int max = editSession.getNearestSurfaceTerrainBlock(pos.getBlockX(), pos.getBlockZ(), pos.getBlockY(), 0, editSession.getMaxY());
        if (max == -1) return;
        pos.mutY(max);
        path.add(pos);
        editSession.getPlayer().sendMessage(BBC.getPrefix() + BBC.BRUSH_SPLINE_PRIMARY_2.s());
        if (!vis) return;
    }
    LocalBlockVectorSet vset = new LocalBlockVectorSet();
    final List<Node> nodes = new ArrayList<>(path.size());
    final KochanekBartelsInterpolation interpol = new KochanekBartelsInterpolation();

    for (final Vector nodevector : path) {
        final Node n = new Node(nodevector);
        n.setTension(tension);
        n.setBias(bias);
        n.setContinuity(continuity);
        nodes.add(n);
    }
    interpol.setNodes(nodes);
    final double splinelength = interpol.arcLength(0, 1);
    for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
        final Vector tipv = interpol.getPosition(loop);
        final int tipx = MathMan.roundInt(tipv.getX());
        final int tipz = (int) tipv.getZ();
        int tipy = MathMan.roundInt(tipv.getY());
        tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
        if (tipy == -1) continue;
        if (radius == 0) {
            editSession.setBlock(tipx, tipy, tipz, pattern.next(tipx, tipy, tipz));
        } else {
            vset.add(tipx, tipy, tipz);
        }
    }
    if (radius != 0) {
        double radius2 = (radius * radius);
        LocalBlockVectorSet newSet = new LocalBlockVectorSet();
        final int ceilrad = (int) Math.ceil(radius);
        for (final Vector v : vset) {
            final int tipx = v.getBlockX(), tipy = v.getBlockY(), tipz = v.getBlockZ();
            for (int loopx = tipx - ceilrad; loopx <= (tipx + ceilrad); loopx++) {
                for (int loopz = tipz - ceilrad; loopz <= (tipz + ceilrad); loopz++) {
                    if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
                        int y = editSession.getNearestSurfaceTerrainBlock(loopx, loopz, v.getBlockY(), 0, maxY);
                        if (y == -1) continue;
                        newSet.add(loopx, y, loopz);
                    }
                }
            }
        }
        editSession.setBlocks(newSet, pattern);
        if (!vis) path.clear();
    }
    editSession.getPlayer().sendMessage(BBC.getPrefix() + BBC.BRUSH_SPLINE_SECONDARY.s());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:60,代码来源:SurfaceSpline.java

示例4: visualize

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Deprecated
public synchronized void visualize(BrushTool.BrushAction action, Player player) throws MaxChangedBlocksException {
    VisualMode mode = getVisualMode();
    if (mode == VisualMode.NONE) {
        return;
    }
    BrushSettings current = getContext();
    Brush brush = current.getBrush();
    if (brush == null) return;
    FawePlayer<Object> fp = FawePlayer.wrap(player);
    EditSession editSession = new EditSessionBuilder(player.getWorld())
            .player(fp)
            .allowedRegionsEverywhere()
            .autoQueue(false)
            .blockBag(null)
            .changeSetNull()
            .combineStages(false)
            .build();
    VisualExtent newVisualExtent = new VisualExtent(editSession.getExtent(), editSession.getQueue());
    Vector position = getPosition(editSession, player);
    if (position != null) {
        editSession.setExtent(newVisualExtent);
        switch (mode) {
            case POINT: {
                editSession.setBlockFast(position, FaweCache.getBlock(VisualChunk.VISUALIZE_BLOCK, 0));
                break;
            }
            case OUTLINE: {
                new PatternTraverser(current).reset(editSession);
                brush.build(editSession, position, current.getMaterial(), current.getSize());
                break;
            }
        }
    }
    if (visualExtent != null) {
        // clear old data
        visualExtent.clear(newVisualExtent, fp);
    }
    visualExtent = newVisualExtent;
    newVisualExtent.visualize(fp);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:42,代码来源:BrushTool.java


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