本文整理汇总了Java中com.sk89q.worldedit.Vector2D类的典型用法代码示例。如果您正苦于以下问题:Java Vector2D类的具体用法?Java Vector2D怎么用?Java Vector2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector2D类属于com.sk89q.worldedit包,在下文中一共展示了Vector2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: pastePositionDirect
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
/**
* Paste structure at the provided position on the curve. The position will not be position-corrected
* but will be passed directly to the interpolation algorithm.
* @param position The position on the curve. Must be between 0.0 and 1.0 (both inclusive)
* @return The amount of blocks that have been changed
* @throws MaxChangedBlocksException Thrown by WorldEdit if the limit of block changes for the {@link EditSession} has been reached
*/
public int pastePositionDirect(double position) throws MaxChangedBlocksException {
Preconditions.checkArgument(position >= 0);
Preconditions.checkArgument(position <= 1);
// Calculate position from spline
Vector target = interpolation.getPosition(position);
Vector offset = target.subtract(target.round());
target = target.subtract(offset);
// Calculate rotation from spline
Vector deriv = interpolation.get1stDerivative(position);
Vector2D deriv2D = new Vector2D(deriv.getX(), deriv.getZ()).normalize();
double angle = Math.toDegrees(
Math.atan2(direction.getZ(), direction.getX()) - Math.atan2(deriv2D.getZ(), deriv2D.getX())
);
return pasteBlocks(target, offset, angle);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:Spline.java
示例2: chunkInfo
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Command(
aliases = {"chunkinfo"},
usage = "",
desc = "Get information about the chunk that you are inside",
min = 0,
max = 0
)
@CommandPermissions("worldedit.chunkinfo")
public void chunkInfo(Player player, LocalSession session, CommandContext args) throws WorldEditException {
Vector pos = player.getBlockIn();
int chunkX = (int) Math.floor(pos.getBlockX() / 16.0);
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
String folder1 = Integer.toString(MathUtils.divisorMod(chunkX, 64), 36);
String folder2 = Integer.toString(MathUtils.divisorMod(chunkZ, 64), 36);
String filename = "c." + Integer.toString(chunkX, 36)
+ "." + Integer.toString(chunkZ, 36) + ".dat";
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename(
new Vector2D(chunkX, chunkZ)));
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:ChunkCommands.java
示例3: negate
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
/**
* Negate the given mask.
*
* @param mask the mask
* @return a new mask
*/
public static Mask2D negate(final Mask2D mask) {
if (mask instanceof AlwaysTrue) {
return ALWAYS_FALSE;
} else if (mask instanceof AlwaysFalse) {
return ALWAYS_TRUE;
}
checkNotNull(mask);
return new AbstractMask2D() {
@Override
public boolean test(Vector2D vector) {
return !mask.test(vector);
}
};
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:Masks.java
示例4: getChunks
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public Set<Vector2D> getChunks() {
final Set<Vector2D> chunks = new HashSet<Vector2D>();
final Vector min = getMinimumPoint();
final Vector max = getMaximumPoint();
final int centerY = getCenter().getBlockY();
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
if (!contains(new BlockVector(x, centerY, z))) {
continue;
}
chunks.add(new BlockVector2D(
x >> ChunkStore.CHUNK_SHIFTS,
z >> ChunkStore.CHUNK_SHIFTS
));
}
}
return chunks;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:EllipsoidRegion.java
示例5: setlighting
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Command(
aliases = {"/setblocklight", "/setlight"},
desc = "Set block lighting in a selection",
min = 1,
max = 1
)
@CommandPermissions("worldedit.light.set")
public void setlighting(Player player, @Selection Region region, @Range(min = 0, max = 15) int value) {
FawePlayer fp = FawePlayer.wrap(player);
final FaweLocation loc = fp.getLocation();
final int cx = loc.x >> 4;
final int cz = loc.z >> 4;
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
for (Vector pt : region) {
queue.setBlockLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
}
int count = 0;
for (Vector2D chunk : region.getChunks()) {
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
count++;
}
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:RegionCommands.java
示例6: setskylighting
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Command(
aliases = {"/setskylight"},
desc = "Set sky lighting in a selection",
min = 1,
max = 1
)
@CommandPermissions("worldedit.light.set")
public void setskylighting(Player player, @Selection Region region, @Range(min = 0, max = 15) int value) {
FawePlayer fp = FawePlayer.wrap(player);
final FaweLocation loc = fp.getLocation();
final int cx = loc.x >> 4;
final int cz = loc.z >> 4;
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
for (Vector pt : region) {
queue.setSkyLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
}
int count = 0;
for (Vector2D chunk : region.getChunks()) {
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
count++;
}
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:RegionCommands.java
示例7: getBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public BaseBiome getBiome(Vector2D position) {
BukkitImplAdapter adapter = BukkitQueue_0.getAdapter();
if (adapter != null) {
int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
return new BaseBiome(id);
} else {
return new BaseBiome(0);
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:BukkitWorld.java
示例8: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
BukkitImplAdapter adapter = BukkitQueue_0.getAdapter();
if (adapter != null) {
Biome bukkitBiome = adapter.getBiome(biome.getId());
getWorld().setBiome(position.getBlockX(), position.getBlockZ(), bukkitBiome);
return true;
} else {
return false;
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:BukkitWorld.java
示例9: add
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
public void add(Vector2D pos1, Vector2D pos2) {
int ccx1 = pos1.getBlockX() >> 9;
int ccz1 = pos1.getBlockZ() >> 9;
int ccx2 = pos2.getBlockX() >> 9;
int ccz2 = pos2.getBlockZ() >> 9;
for (int x = ccx1; x <= ccx2; x++) {
for (int z = ccz1; z <= ccz2; z++) {
if (!occupiedRegions.containsKey(x, z)) {
occupiedRegions.add(x, z);
int bcx = x << 5;
int bcz = z << 5;
int tcx = bcx + 32;
int tcz = bcz + 32;
for (int cz = bcz; cz < tcz; cz++) {
for (int cx = bcx; cx < tcx; cx++) {
unoccupiedChunks.add(cx, cz);
}
}
}
}
}
int cx1 = pos1.getBlockX() >> 4;
int cz1 = pos1.getBlockZ() >> 4;
int cx2 = pos2.getBlockX() >> 4;
int cz2 = pos2.getBlockZ() >> 4;
for (int cz = cz1; cz <= cz2; cz++) {
for (int cx = cx1; cx <= cx2; cx++) {
unoccupiedChunks.remove(cx, cz);
}
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:CuboidRegionFilter.java
示例10: apply
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean apply(Vector2D position) throws WorldEditException {
int x = position.getBlockX();
int z = position.getBlockZ();
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY);
if (layer != -1) {
lastY = layer;
return function.apply(mutable.setComponents(x, layer, z));
}
return false;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:SurfaceRegionFunction.java
示例11: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
if (region.contains(position.getBlockX(), position.getBlockZ())) {
return super.setBiome(position, biome);
}
return false;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:MaskedFaweQueue.java
示例12: getBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public BaseBiome getBiome(Vector2D position) {
mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ());
mutable.mutY(0);
return super.getBiome(getPos(mutable).toVector2D());
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:PositionTransformExtent.java
示例13: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
mutable.mutX(position.getBlockX());
mutable.mutZ(position.getBlockZ());
mutable.mutY(0);
return super.setBiome(getPos(mutable).toVector2D(), biome);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:PositionTransformExtent.java
示例14: getBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public BaseBiome getBiome(Vector2D position) {
if (position.getX() == bx && position.getZ() == bz) {
return biome;
}
return super.getBiome(position);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:TemporalExtent.java
示例15: listChunks
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Command(
aliases = {"listchunks"},
usage = "",
desc = "List chunks that your selection includes",
min = 0,
max = 0
)
@CommandPermissions("worldedit.listchunks")
public void listChunks(Player player, LocalSession session, CommandContext args) throws WorldEditException {
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
for (Vector2D chunk : chunks) {
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:16,代码来源:ChunkCommands.java
示例16: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
if (!contains(position)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_FAILS);
}
return false;
}
return super.setBiome(position, biome);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:FaweRegionExtent.java
示例17: getBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public BaseBiome getBiome(Vector2D position) {
if (!contains(position)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_FAILS);
}
return EditSession.nullBiome;
}
return super.getBiome(position);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:FaweRegionExtent.java
示例18: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(final Vector2D position, final BaseBiome biome) {
if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
return false;
}
return super.setBiome(position, biome);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:9,代码来源:ProcessedWEExtent.java
示例19: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
boolean result = false;
Vector pos = getPos(position.getBlockX(), 0, position.getBlockZ());
double sx = pos.getX();
double sz = pos.getZ();
double ex = pos.getX() + dx;
double ez = pos.getZ() + dz;
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
result |= super.setBiome(pos.toVector2D(), biome);
}
}
return result;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:16,代码来源:ScaleTransform.java
示例20: setBiome
import com.sk89q.worldedit.Vector2D; //导入依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome newBiome) {
BaseBiome oldBiome = this.getBiome(position);
if (oldBiome.getId() != newBiome.getId()) {
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockZ(), oldBiome, newBiome);
return getExtent().setBiome(position, newBiome);
} else {
return false;
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:HistoryExtent.java
注:本文中的com.sk89q.worldedit.Vector2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论