本文整理汇总了Java中com.sk89q.worldedit.regions.CuboidRegion.getMinimumPoint方法的典型用法代码示例。如果您正苦于以下问题:Java CuboidRegion.getMinimumPoint方法的具体用法?Java CuboidRegion.getMinimumPoint怎么用?Java CuboidRegion.getMinimumPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.regions.CuboidRegion
的用法示例。
在下文中一共展示了CuboidRegion.getMinimumPoint方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例5: execute
import com.sk89q.worldedit.regions.CuboidRegion; //导入方法依赖的package包/类
@Override
protected void execute(Event e) {
WorldEditPlugin wep = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
LocalSession session = wep.getSession(pl.getSingle(e));
Location point1loc = point1.getSingle(e);
Location point2loc = point2.getSingle(e);
Vector min = new Vector(point1loc.getBlockX(), point1loc.getBlockY(), point1loc.getZ());
Vector max = new Vector(point2loc.getBlockX(), point2loc.getBlockY(), point2loc.getZ());
CuboidRegion cr = new CuboidRegion(min, max);
BlockArrayClipboard bc = new BlockArrayClipboard(cr);
EditSession es = wep.createEditSession(pl.getSingle(e));
try {
if (origin == null) {
bc.setOrigin(session.getPlacementPosition(wep.wrapPlayer(pl.getSingle(e))));
} else {
Location originloc = origin.getSingle(e);
Vector originvec = new Vector(originloc.getBlockX(), originloc.getBlockY(), originloc.getBlockZ());
bc.setOrigin(originvec);
}
session.setClipboard(new ClipboardHolder(bc, es.getWorld().getWorldData()));
ForwardExtentCopy copy = new ForwardExtentCopy(es, cr, bc, cr.getMinimumPoint());
Operations.complete(copy);
} catch (WorldEditException e1) {
main core = (main) Bukkit.getPluginManager().getPlugin("SharpSK");
core.getLogger().warning("Failed to save selection. Something went wrong");
return;
}
}
示例6: 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());
}
示例7: 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();
}