當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector.getX方法代碼示例

本文整理匯總了Java中com.sk89q.worldedit.Vector.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector.getX方法的具體用法?Java Vector.getX怎麽用?Java Vector.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sk89q.worldedit.Vector的用法示例。


在下文中一共展示了Vector.getX方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setBlock

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
    boolean result = false;
    Vector pos = getPos(location);
    double sx = pos.getX();
    double sy = pos.getY();
    double sz = pos.getZ();
    double ex = sx + dx;
    double ey = Math.min(maxy, sy + dy);
    double ez = sz + dz;
    for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
        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.setBlock(pos, block);
            }
        }
    }
    return result;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:20,代碼來源:ScaleTransform.java

示例2: getVertex

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
public static Vector getVertex(Vector pos1, Vector pos2, double lenPercent) {
    if (lenPercent <= 1) return Vector.getMidpoint(pos1, pos2);
    double curveLen = pos1.distance(pos2) * lenPercent;
    double dy = pos2.getY() - pos1.getY();
    double dx = pos2.getX() - pos1.getX();
    double dz = pos2.getZ() - pos1.getZ();
    double dh = Math.sqrt(dx * dx + dz * dz);
    double g = Math.sqrt(curveLen * curveLen - dy * dy) / 2;
    double a = 0.00001;
    for (;g < a * Math.sinh(dh/(2 * a)); a *= 1.00001);
    double vertX = (dh-a*Math.log((curveLen + dy)/(curveLen - dy)))/2.0;
    double z = (dh/2)/a;
    double oY = (dy - curveLen * (Math.cosh(z) / Math.sinh(z))) / 2;
    double vertY = a * 1 + oY;
    return pos1.add(pos2.subtract(pos1).multiply(vertX / dh).add(0, vertY, 0)).round();
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:17,代碼來源:CatenaryBrush.java

示例3: ArbitraryShape

import com.sk89q.worldedit.Vector; //導入方法依賴的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: setPosition

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public void setPosition(Vector pos, float pitch, float yaw) {
    org.spongepowered.api.world.Location<World> loc = new org.spongepowered.api.world.Location<>(
            this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ()
    );

    this.player.setLocationAndRotation(loc, new Vector3d(pitch, yaw, 0));
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:9,代碼來源:SpongePlayer.java

示例5: adapt

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
private static org.bukkit.Location adapt(org.bukkit.World world, Vector position) {
    checkNotNull(world);
    checkNotNull(position);
    return new org.bukkit.Location(
            world,
            position.getX(), position.getY(), position.getZ());
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:8,代碼來源:BukkitWorld.java

示例6: getWalls

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
/**
 * Get a region that contains the walls (all faces but the ones parallel to
 * the X-Z plane) of this cuboid.
 *
 * @return a new complex region
 */
public Region getWalls() {
    Vector min = getMinimumPoint();
    Vector max = getMaximumPoint();

    return new RegionIntersection(
            // Project to Z-Y plane
            new CuboidRegion(new Vector(min.getX(), pos1.getY(), pos1.getZ()), new Vector(min.getX(), pos2.getY(), pos2.getZ())),
            new CuboidRegion(new Vector(max.getX(), pos1.getY(), pos1.getZ()), new Vector(max.getX(), pos2.getY(), pos2.getZ())),

            // Project to X-Y plane
            new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), min.getZ()), new Vector(pos2.getX(), pos2.getY(), min.getZ())),
            new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), max.getZ()), new Vector(pos2.getX(), pos2.getY(), max.getZ())));
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:20,代碼來源:CuboidRegion.java

示例7: getBlock

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
public static BaseBlock getBlock(Level level, Vector position) {
    Vector3 pos = new Vector3(position.getX(), position.getY(), position.getZ());
    Block block = level.getBlock(pos);
    int id = block.getId();
    int data = block.getDamage();
    return new BaseBlock(id, data);
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:8,代碼來源:NukkitUtil.java

示例8: getBlock

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public BaseBlock getBlock(Vector position) {
    BaseBlock tmp = pattern.apply(position);
    if (position == target || (position.getX() == target.getX() && position.getY() == target.getY() && position.getZ() == target.getZ())) {
        block = tmp;
    } else {
        block = null;
    }
    return tmp;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:11,代碼來源:PatternExtent.java

示例9: checkConfirmationStack

import com.sk89q.worldedit.Vector; //導入方法依賴的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

示例10: checkConfirmationRegion

import com.sk89q.worldedit.Vector; //導入方法依賴的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

示例11: getBlock

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public BaseBlock getBlock(Vector position) {
    if (position.getX() == x && position.getY() == y && position.getZ() == z) {
        return block;
    }
    return super.getBlock(position);
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:8,代碼來源:TemporalExtent.java

示例12: any90Rotate

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
private Vector any90Rotate(Vector normal) {
    normal = normal.normalize();
    if (normal.getX() == 1 || normal.getY() == 1 || normal.getZ() == 1) {
        return new Vector(normal.getZ(), normal.getX(), normal.getY());
    }
    AffineTransform affine = new AffineTransform();
    affine = affine.rotateX(90);
    affine = affine.rotateY(90);
    affine = affine.rotateZ(90);
    Vector random = affine.apply(normal);
    return random.cross(normal).normalize();
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:13,代碼來源:CircleBrush.java

示例13: apply

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
    public Vector apply(Vector vector) {
        // vector.getX() * m00 + vector.getY() * m01 + vector.getZ() * m02 + m03
        // vector.getX() * m10 + vector.getY() * m11 + vector.getZ() * m12 + m13
        // vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23
        return new Vector(
                vector.getX() * m00 + vector.getY() * m01 + vector.getZ() * m02 + m03,
                vector.getX() * m10 + vector.getY() * m11 + vector.getZ() * m12 + m13,
                vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23);
//        mutable.mutX((vector.getX() * m00 + vector.getY() * m01 + vector.getZ() * m02 + m03));
//        mutable.mutY((vector.getX() * m10 + vector.getY() * m11 + vector.getZ() * m12 + m13));
//        mutable.mutZ((vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23));
//        return mutable;
    }
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:15,代碼來源:AffineTransform.java

示例14: stack

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Command(
        aliases = {"/stack"},
        usage = "[count] [direction]",
        flags = "sam",
        desc = "Repeat the contents of the selection",
        help =
                "Repeats the contents of the selection.\n" +
                        "Flags:\n" +
                        "  -s shifts the selection to the last stacked copy\n" +
                        "  -a skips air blocks",
        min = 0,
        max = 2
)
@CommandPermissions("worldedit.region.stack")
@Logging(ORIENTATION_REGION)
public void stack(FawePlayer player, LocalSession session, EditSession editSession,
                  @Selection Region region,
                  @Optional("1") @Range(min = 1) int count,
                  @Optional(Direction.AIM) @Direction Vector direction,
                  @Switch('s') boolean moveSelection,
                  @Switch('b') boolean copyBiomes,
                  @Switch('e') boolean skipEntities,
                  @Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException {
    player.checkConfirmationStack(getArguments(context), region, count);
    if (sourceMask != null) {
        editSession.addSourceMask(sourceMask);
    }
    int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks, !skipEntities, copyBiomes);

    if (moveSelection) {
        try {
            final Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
            Vector shiftVector = new Vector(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
            region.shift(shiftVector);

            session.getRegionSelector(player.getWorld()).learnChanges();
            session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session);
        } catch (RegionOperationException e) {
            player.sendMessage(BBC.getPrefix() + e.getMessage());
        }
    }

    BBC.VISITOR_BLOCK.send(player, affected);
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:45,代碼來源:RegionCommands.java

示例15: toLocation

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
public static cn.nukkit.level.Location toLocation(Level world, Vector pt) {
    return new cn.nukkit.level.Location(pt.getX(), pt.getY(), pt.getZ(), 0, 0, world);
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:4,代碼來源:NukkitUtil.java


注:本文中的com.sk89q.worldedit.Vector.getX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。