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


Java Vector类代码示例

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


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

示例1: setBlock

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
  public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
  {
  	Player player = WorldGuardExtraFlagsPlugin.getPlugin().getServer().getPlayer(this.actor.getUniqueId());
if (WorldGuardUtils.hasBypass(player))
  	{
  		return super.setBlock(location, block);
  	}
  	else
  	{
  		if (WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(BukkitUtil.toLocation(player.getWorld(), location)).queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.WORLDEDIT) != State.DENY)
  		{
  			return super.setBlock(location, block);
  		}
  		else
  		{
  			return false;
  		}
  	}
  }
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:21,代码来源:WorldEditFlag.java

示例2: execute

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	World world = (World) this.world.getSingle(event);
	ItemStack block = (ItemStack) this.block.getSingle(event);

	RegionManager regionManager = WGBukkit.getRegionManager((org.bukkit.World) world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	Vector v1 = regionManager.getRegion(name).getMaximumPoint();
	Vector v2 = regionManager.getRegion(name).getMinimumPoint();
	Region region = new CuboidRegion(v1, v2);
	BaseBlock b = new BaseBlock(block.getTypeId(), block.getData().getData());

	EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
	try {
		es.setBlocks(region, b);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:24,代码来源:EffSetBlocks.java

示例3: execute

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	Location loc1 = (Location) this.loc1.getSingle(event);
	Location loc2 = (Location) this.loc2.getSingle(event);
	World world = (World) this.world.getSingle(event);

	int x1 = loc1.getBlockX();
	int y1 = loc1.getBlockY();
	int z1 = loc1.getBlockZ();

	int x2 = loc2.getBlockX();
	int y2 = loc2.getBlockY();
	int z2 = loc2.getBlockZ();

	Vector p1 = new Vector(x1, y1, z1);
	Vector p2 = new Vector(x2, y2, z2);
	RegionManager regionManager = WGBukkit.getRegionManager(world);
	ProtectedCuboidRegion region = new ProtectedCuboidRegion(name, p1.toBlockVector(), p2.toBlockVector());
	regionManager.addRegion(region);
	try {
		regionManager.save();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:26,代码来源:EffCreateRegion.java

示例4: test

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public boolean test(Vector to) {
    if (pos == null) {
        pos = new MutableBlockVector(to);
    }
    int dx = pos.getBlockX() - to.getBlockX();
    int d = dx * dx;
    if (d > maxSqr) {
        return false;
    }
    int dz = pos.getBlockZ() - to.getBlockZ();
    d += dz * dz;
    if (d > maxSqr) {
        return false;
    }
    int dy = pos.getBlockY() - to.getBlockY();
    d += dy * dy;
    if (d < minSqr || d > maxSqr) {
        return false;
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:RadiusMask.java

示例5: dispatchCUIEvent

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public void dispatchCUIEvent(CUIEvent event) {
    if (event instanceof SelectionShapeEvent) {
        clear();
        this.cuboid = event.getParameters()[0].equalsIgnoreCase("cuboid");
    } else if (cuboid && event instanceof SelectionPointEvent) {
        SelectionPointEvent spe = (SelectionPointEvent) event;
        String[] param = spe.getParameters();
        int id = Integer.parseInt(param[0]);
        int x = Integer.parseInt(param[1]);
        int y = Integer.parseInt(param[2]);
        int z = Integer.parseInt(param[3]);
        Vector pos = new Vector(x, y, z);
        if (id == 0) {
            pos1 = pos;
        } else {
            pos2 = pos;
        }
        update();
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:StructureCUI.java

示例6: createProxy

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
public PlayerProxy createProxy() {
    Player player = getPlayer();
    World world = getWorldForEditing();

    PlatformManager platformManager = WorldEdit.getInstance().getPlatformManager();

    Player permActor = platformManager.queryCapability(Capability.PERMISSIONS).matchPlayer(player);
    if (permActor == null) {
        permActor = player;
    }

    Player cuiActor = platformManager.queryCapability(Capability.WORLDEDIT_CUI).matchPlayer(player);
    if (cuiActor == null) {
        cuiActor = player;
    }

    PlayerProxy proxy = new PlayerProxy(player, permActor, cuiActor, world);
    if (world instanceof HeightMapMCAGenerator) {
        proxy.setOffset(Vector.ZERO.subtract(((HeightMapMCAGenerator) world).getOrigin()));
    }
    return proxy;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:FawePlayer.java

示例7: removeLayers

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Command(
        aliases = {"removelayers"},
        usage = "<id>",
        desc = "Removes matching chunk layers",
        help = "Remove if all the selected layers in a chunk match the provided id"
)
@CommandPermissions("worldedit.anvil.removelayer")
public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException {
    Vector min = selection.getMinimumPoint();
    Vector max = selection.getMaximumPoint();
    int minY = min.getBlockY();
    int maxY = max.getBlockY();
    RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
    MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
    if (result != null) {
        player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal()));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:AnvilCommands.java

示例8: clearContainerBlockContents

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public boolean clearContainerBlockContents(Vector position) {
    BaseBlock block = extent.getLazyBlock(position);
    if (block.hasNbtData()) {
        Map<String, Tag> nbt = ReflectionUtils.getMap(block.getNbtData().getValue());
        if (nbt.containsKey("Items")) {
            nbt.put("Items", new ListTag(CompoundTag.class, new ArrayList<CompoundTag>()));
            try {
                extent.setBlock(position, block);
            } catch (WorldEditException e) {
                e.printStackTrace();
            }
        }
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:MCAWorld.java

示例9: getInformationLines

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public List<String> getInformationLines() {
    final List<String> lines = new ArrayList<String>();

    final Vector center = region.getCenter();
    if (center.lengthSq() > 0) {
        lines.add("Center: " + center);
    }

    final Vector radius = region.getRadius();
    if (radius.lengthSq() > 0) {
        lines.add("X/Y/Z radius: " + radius);
    }

    return lines;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:EllipsoidRegionSelector.java

示例10: setBlock

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public boolean setBlock(int x1, int y1, int z1, BaseBlock block) throws WorldEditException {
    boolean result = false;
    Vector pos = getPos(x1, y1, z1);
    double sx = pos.getX();
    double sy = pos.getY();
    double sz = pos.getZ();
    double ex = pos.getX() + dx;
    double ey = Math.min(maxy, sy + dy);
    double ez = pos.getZ() + 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

示例11: setBlock

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public boolean setBlock(final Vector location, final BaseBlock block) throws WorldEditException {
    if (super.setBlock(location, block)) {
        if (MemUtil.isMemoryLimited()) {
            if (this.player != null) {
                player.sendMessage(BBC.WORLDEDIT_CANCEL_REASON.format(BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY.s()));
                if (Perm.hasPermission(this.player, "worldedit.fast")) {
                    BBC.WORLDEDIT_OOM_ADMIN.send(this.player);
                }
            }
            WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY);
            return false;
        }
        return true;
    }
    return false;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:MemoryCheckingExtent.java

示例12: 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

示例13: explainPrimarySelection

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
    checkNotNull(player);
    checkNotNull(session);
    checkNotNull(pos);

    Message msg;
    if (position1 != null && position2 != null) {
        msg = BBC.SELECTOR_POS.m(1, position1, region.getArea());
    } else {
        msg = BBC.SELECTOR_POS.m(1, position1, "");
    }
    String prefix = WorldEdit.getInstance().getConfiguration().noDoubleSlash ? "" : "/";
    String cmd = prefix + Commands.getAlias(SelectionCommands.class, "/pos1") + " " + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ();
    msg.suggestTip(cmd).send(player);

    session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos, getArea()));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:CuboidRegionSelector.java

示例14: hsphere

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Command(
        aliases = {"/hsphere"},
        usage = "<pattern> <radius>[,<radius>,<radius>] [raised?]",
        desc = "Generates a hollow sphere.",
        help =
                "Generates a hollow sphere.\n" +
                        "By specifying 3 radii, separated by commas,\n" +
                        "you can generate an ellipsoid. The order of the ellipsoid radii\n" +
                        "is north/south, up/down, east/west.",
        min = 2,
        max = 3
)
@CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT)
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException {
    sphere(fp, player, session, editSession, pattern, radius, raised, true, context);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:GenerationCommands.java

示例15: swap

import com.sk89q.worldedit.Vector; //导入依赖的package包/类
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
    TaskManager.IMP.async(new Runnable() {
        @Override
        public void run() {
            EditSession sessionA = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
            EditSession sessionB = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
            CuboidRegion regionA = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
            CuboidRegion regionB = new CuboidRegion(new Vector(pos3.getX(), pos3.getY(), pos3.getZ()), new Vector(pos4.getX(), pos4.getY(), pos4.getZ()));
            ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint());
            ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
            try {
                Operations.completeLegacy(copyA);
                Operations.completeLegacy(copyB);
                sessionA.flushQueue();
                sessionB.flushQueue();
            } catch (MaxChangedBlocksException e) {
                e.printStackTrace();
            }
            TaskManager.IMP.task(whenDone);
        }
    });
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:FaweChunkManager.java


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