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


Java CuboidRegion.getMaximumPoint方法代码示例

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


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

示例1: runWithSelection

import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
/**
 * Run safely on an existing world within a selection
 *
 * @param player
 * @param editSession
 * @param selection
 * @param filter
 * @param <G>
 * @param <T>
 * @return
 */
@Deprecated
public static <G, T extends MCAFilter<G>> T runWithSelection(Player player, EditSession editSession, Region selection, T filter) {
    if (!(selection instanceof CuboidRegion)) {
        BBC.NO_REGION.send(player);
        return null;
    }
    CuboidRegion cuboid = (CuboidRegion) selection;
    RegionWrapper wrappedRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
    String worldName = Fawe.imp().getWorldName(editSession.getWorld());
    FaweQueue tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
    MCAQueue queue = new MCAQueue(tmp);
    FawePlayer<Object> fp = FawePlayer.wrap(player);
    fp.checkAllowedRegion(selection);
    recordHistory(fp, editSession.getWorld(), iAnvilHistory -> {
        queue.filterCopy(filter, wrappedRegion, iAnvilHistory);
    });
    return filter;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:30,代码来源:AnvilCommands.java

示例2: generateSpawnpoints

import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
@Override
public void generateSpawnpoints(CuboidRegion region, World world, List<Location> spawnpoints, int n) {
	Vector min = region.getMinimumPoint();
	Vector max = region.getMaximumPoint();
	
	int dx = max.getBlockX() - min.getBlockX();
	int dz = max.getBlockZ() - min.getBlockZ();
	int py = max.getBlockY() + 1;
	
	for (int i = 0; i < n; i++) {
		int rx = (int) (Math.random() * dx);
		int rz = (int) (Math.random() * dz);
		
		int px = min.getBlockX() + rx;
		int pz = min.getBlockZ() + rz;
		
		Location location = new Location(world, px + 0.5, py, pz + 0.5);
		spawnpoints.add(location);
	}
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:21,代码来源:CuboidSpawnpointGenerator.java

示例3: isInBounds

import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
private boolean isInBounds(Location loc, CuboidRegion bounds) {
        boolean result;
        double x = Math.floor(loc.getX());
        double y = Math.floor(loc.getY());
        double z = Math.floor(loc.getZ());

        Vector min = bounds.getMinimumPoint();
        Vector max = bounds.getMaximumPoint();
        result = (x >= Math.floor(min.getX()) && x <= Math.floor(max.getX())
                && y >= Math.floor(min.getY()) && y <= Math.floor(max.getY())
                && z >= Math.floor(min.getZ()) && z <= Math.floor(max.getZ()));

//        MCMEAnimations.MCMEAnimationsInstance.getLogger().info("-------TESTING--------");
//        MCMEAnimations.MCMEAnimationsInstance.getLogger().log(Level.INFO, "Loc - X: {0} Y:{1} Z: {2}", new Object[]{x, y, z});
//        MCMEAnimations.MCMEAnimationsInstance.getLogger().log(Level.INFO, "Min - X: {0} Y:{1} Z: {2}", new Object[]{min.getX(), min.getY(), min.getZ()});
//        MCMEAnimations.MCMEAnimationsInstance.getLogger().log(Level.INFO, "Max - X: {0} Y:{1} Z: {2}", new Object[]{max.getX(), max.getY(), max.getZ()});
        return result;
    }
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:19,代码来源:MovePlayersAction.java

示例4: getRandVector

import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
/**Get a random position (Vector) from a target region. Dos not use the DunGen seed!
 * @param r 	The region.
 * @return		The vector.
 */
public static Vector getRandVector(CuboidRegion r) {
	// will be a half point off to be in center of a block (block vs. world coordinates!) meh
	Random rand = new Random();
	Vector targetV = new Vector();
	Vector minP = r.getMinimumPoint();
	Vector maxP = r.getMaximumPoint();
	targetV = targetV.setX(minP.getBlockX() + rand.nextInt(maxP.getBlockX() - minP.getBlockX() + 1)); //plus 1 needed for inclusive boundary of values
	targetV = targetV.setY(minP.getBlockY() + rand.nextInt(maxP.getBlockY() - minP.getBlockY() + 1));
	targetV = targetV.setZ(minP.getBlockZ() + rand.nextInt(maxP.getBlockZ() - minP.getBlockZ() + 1));
	return targetV;
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:16,代码来源:Helper.java

示例5: paste

import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
@Command(
        aliases = {"paste"},
        desc = "Paste chunks from your anvil clipboard",
        help =
                "Paste the chunks from your anvil clipboard.\n" +
                        "The -c flag will align the paste to the chunks.",
        flags = "c"

)
@CommandPermissions("worldedit.anvil.pastechunks")
public void paste(Player player, LocalSession session, EditSession editSession, @Switch('c') boolean alignChunk) throws WorldEditException, IOException {
    FawePlayer fp = FawePlayer.wrap(player);
    MCAClipboard clipboard = fp.getMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD);
    if (clipboard == null) {
        fp.sendMessage(BBC.getPrefix() + "You must first use `//anvil copy`");
        return;
    }
    CuboidRegion cuboid = clipboard.getRegion();
    RegionWrapper copyRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
    final Vector offset = player.getPosition().subtract(clipboard.getOrigin());
    if (alignChunk) {
        offset.setComponents((offset.getBlockX() >> 4) << 4, offset.getBlockY(), (offset.getBlockZ() >> 4) << 4);
    }
    int oX = offset.getBlockX();
    int oZ = offset.getBlockZ();
    RegionWrapper pasteRegion = new RegionWrapper(copyRegion.minX + oX, copyRegion.maxX + oX, copyRegion.minZ + oZ, copyRegion.maxZ + oZ);
    String pasteWorldName = Fawe.imp().getWorldName(editSession.getWorld());
    FaweQueue tmpTo = SetQueue.IMP.getNewQueue(pasteWorldName, true, false);
    MCAQueue copyQueue = clipboard.getQueue();
    MCAQueue pasteQueue = new MCAQueue(tmpTo);

    fp.checkAllowedRegion(pasteRegion);
    recordHistory(fp, editSession.getWorld(), iAnvilHistory -> {
        try {
            pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
        } catch (IOException e) { throw new RuntimeException(e); }
    });
    BBC.COMMAND_PASTE.send(player, player.getPosition().toBlockVector());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:40,代码来源:AnvilCommands.java

示例6: setBlocks

import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
default int setBlocks(CuboidRegion cuboid, final int id, final int data) {
    RegionWrapper current = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
    final int minY = cuboid.getMinimumY();
    final int maxY = cuboid.getMaximumY();

    final FaweChunk<?> fc = getFaweChunk(0, 0);
    final byte dataByte = (byte) data;
    fc.fillCuboid(0, 15, minY, maxY, 0, 15, id, dataByte);
    fc.optimize();

    int bcx = (current.minX) >> 4;
    int bcz = (current.minZ) >> 4;

    int tcx = (current.maxX) >> 4;
    int tcz = (current.maxZ) >> 4;
    // [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge]
    MainUtil.chunkTaskSync(current, new RunnableVal<int[]>() {
        @Override
        public void run(int[] value) {
            FaweChunk newChunk;
            if (value[6] == 0) {
                newChunk = fc.copy(true);
                newChunk.setLoc(FaweQueue.this, value[0], value[1]);
            } else {
                int bx = value[2] & 15;
                int tx = value[4] & 15;
                int bz = value[3] & 15;
                int tz = value[5] & 15;
                if (bx == 0 && tx == 15 && bz == 0 && tz == 15) {
                    newChunk = fc.copy(true);
                    newChunk.setLoc(FaweQueue.this, value[0], value[1]);
                } else {
                    newChunk = FaweQueue.this.getFaweChunk(value[0], value[1]);
                    newChunk.fillCuboid(value[2] & 15, value[4] & 15, minY, maxY, value[3] & 15, value[5] & 15, id, dataByte);
                }
            }
            newChunk.addToQueue();
        }
    });
    return cuboid.getArea();
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:42,代码来源:FaweQueue.java


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