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


Java BlockVector.getBlockZ方法代码示例

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


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

示例1: contains

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
public boolean contains(final BlockVector loc) {
    if (loc.getBlockX() < this.position1.getBlockX()) {
        return false;
    }
    if (loc.getBlockX() > this.position2.getBlockX()) {
        return false;
    }
    if (loc.getBlockZ() < this.position1.getBlockZ()) {
        return false;
    }
    if (loc.getBlockZ() > this.position2.getBlockZ()) {
        return false;
    }
    if (loc.getBlockY() < this.position1.getBlockY()) {
        return false;
    }
    if (loc.getBlockY() > this.position2.getBlockY()) {
        return false;
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:FaweMask.java

示例2: containsChunk

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@Override
public boolean containsChunk(int chunkX, int chunkZ) {
    if (!large) return super.containsChunk(chunkX, chunkZ);
    BlockVector pos1 = new BlockVector(chunkX << 4, 0, chunkZ << 4);
    BlockVector pos2 = new BlockVector(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
    ProtectedCuboidRegion chunkRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
    ApplicableRegionSet set = manager.getApplicableRegions(chunkRegion);
    return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:WorldGuardFilter.java

示例3: containsRegion

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@Override
public boolean containsRegion(int mcaX, int mcaZ) {
    if (!large) return super.containsRegion(mcaX, mcaZ);
    BlockVector pos1 = new BlockVector(mcaX << 9, 0, mcaZ << 9);
    BlockVector pos2 = new BlockVector(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
    ProtectedCuboidRegion regionRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
    ApplicableRegionSet set = manager.getApplicableRegions(regionRegion);
    return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:WorldGuardFilter.java

示例4: checkSelection

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
public boolean checkSelection(Player p, PlotPlayer pp, int modifier, long max, Cancellable e) {
    final Selection selection = PlotSquared.worldEdit.getSelection(p);
    if (selection == null) {
        return true;
    }
    final BlockVector pos1 = selection.getNativeMinimumPoint().toBlockVector();
    final BlockVector pos2 = selection.getNativeMaximumPoint().toBlockVector();
    HashSet<RegionWrapper> mask = WEManager.getMask(pp);
    RegionWrapper region = new RegionWrapper(pos1.getBlockX(), pos2.getBlockX(), pos1.getBlockZ(), pos2.getBlockZ());
    if (Settings.REQUIRE_SELECTION) {
        String arg = null;
        if (!WEManager.regionContains(region, mask)) {
            arg = "pos1 + pos2";
        }
        else if (!WEManager.maskContains(mask, pos1.getBlockX(), pos1.getBlockZ())) {
            arg = "pos1";
        }
        else if (!WEManager.maskContains(mask, pos2.getBlockX(), pos2.getBlockZ())) {
            arg = "pos2";
        }
        if (arg != null) {
            e.setCancelled(true);
            MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, arg);
            if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
                MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
            }
            return true;
        }
    }
    if (!WEManager.regionContains(region, mask)) {
        MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2");
        e.setCancelled(true);
        if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
            MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
        }
        return true;
    }
    long volume = Math.abs((pos1.getBlockX() - pos2.getBlockX()) * (pos1.getBlockY() - pos2.getBlockY()) * (pos1.getBlockZ() - pos2.getBlockZ())) * modifier;
    return checkVolume(pp, volume, max, e);
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:41,代码来源:WEListener.java

示例5: compare

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@Override
public int compare(BlockVector o1, BlockVector o2) {
    int resp;
    resp = o1.getBlockX() - o2.getBlockX();
    if (resp == 0) {
        resp = o1.getBlockY() - o2.getBlockY();
        if (resp == 0) {
            resp = o1.getBlockZ() - o2.getBlockZ();
        }
    }
    return resp;
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:13,代码来源:FlagsProcessor.java

示例6: putFence

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
public static void putFence(LibelulaProtectionBlocks plugin, World world, TreeSet<BlockVector> blockVectors) {
    for (BlockVector bv : blockVectors) {
        Location loc = new Location(world, bv.getBlockX(), bv.getBlockY(), bv.getBlockZ());
        if (loc.getBlock().getType() == Material.AIR) {
            loc.getBlock().setType(Material.FENCE);
        }
    }
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:9,代码来源:FlagsProcessor.java

示例7: getWorldEditRegionsInSelection

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
/**
 * Get all WorldGuard regions intersecting with a WorldEdit selection.
 * @param selection The selection to check
 * @return A list with all the WorldGuard regions intersecting with the selection
 */
public static List<ProtectedRegion> getWorldEditRegionsInSelection(Selection selection) {
	// Get all regions inside or intersecting with the WorldEdit selection of the player
	World world = selection.getWorld();
	RegionManager regionManager = AreaShop.getInstance().getWorldGuard().getRegionManager(world);
	ArrayList<ProtectedRegion> result = new ArrayList<>();
	Location selectionMin = selection.getMinimumPoint();
	Location selectionMax = selection.getMaximumPoint();
	for(ProtectedRegion region : regionManager.getRegions().values()) {
		BlockVector regionMin = region.getMinimumPoint();
		BlockVector regionMax = region.getMaximumPoint();
		if(
				(      // x part, resolves to true if the selection and region overlap anywhere on the x-axis
						(regionMin.getBlockX() <= selectionMax.getBlockX() && regionMin.getBlockX() >= selectionMin.getBlockX())
								|| (regionMax.getBlockX() <= selectionMax.getBlockX() && regionMax.getBlockX() >= selectionMin.getBlockX())
								|| (selectionMin.getBlockX() >= regionMin.getBlockX() && selectionMin.getBlockX() <= regionMax.getBlockX())
								|| (selectionMax.getBlockX() >= regionMin.getBlockX() && selectionMax.getBlockX() <= regionMax.getBlockX())
				) && ( // Y part, resolves to true if the selection and region overlap anywhere on the y-axis
						(regionMin.getBlockY() <= selectionMax.getBlockY() && regionMin.getBlockY() >= selectionMin.getBlockY())
								|| (regionMax.getBlockY() <= selectionMax.getBlockY() && regionMax.getBlockY() >= selectionMin.getBlockY())
								|| (selectionMin.getBlockY() >= regionMin.getBlockY() && selectionMin.getBlockY() <= regionMax.getBlockY())
								|| (selectionMax.getBlockY() >= regionMin.getBlockY() && selectionMax.getBlockY() <= regionMax.getBlockY())
				) && ( // Z part, resolves to true if the selection and region overlap anywhere on the z-axis
						(regionMin.getBlockZ() <= selectionMax.getBlockZ() && regionMin.getBlockZ() >= selectionMin.getBlockZ())
								|| (regionMax.getBlockZ() <= selectionMax.getBlockZ() && regionMax.getBlockZ() >= selectionMin.getBlockZ())
								|| (selectionMin.getBlockZ() >= regionMin.getBlockZ() && selectionMin.getBlockZ() <= regionMax.getBlockZ())
								|| (selectionMax.getBlockZ() >= regionMin.getBlockZ() && selectionMax.getBlockZ() <= regionMax.getBlockZ())
				)
		) {
			result.add(region);
		}
	}
	return result;
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:39,代码来源:Utils.java

示例8: getMin

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@Override
public BlockPos getMin() {
    BlockVector min = getHandle().getMinimumPoint();
    return new BlockPos(min.getBlockX(), min.getBlockY(), min.getBlockZ(), getWorld());
}
 
开发者ID:TechzoneMC,项目名称:SpawnShield,代码行数:6,代码来源:ProtectedRegionRegion.java

示例9: getMax

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@Override
public BlockPos getMax() {
    BlockVector max = getHandle().getMaximumPoint();
    return new BlockPos(max.getBlockX(), max.getBlockY(), max.getBlockZ(), getWorld());
}
 
开发者ID:TechzoneMC,项目名称:SpawnShield,代码行数:6,代码来源:ProtectedRegionRegion.java

示例10: onPlayerMove

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
        public void onPlayerMove(PlayerMoveEvent e) {
            boolean moveIntoArena = false;
            BlockVector min = g.getArena().area.getMinimumPoint();
            BlockVector max = g.getArena().area.getMaximumPoint();
            if (e.getTo().getWorld().getName().equals(g.getArena().capturePoint.getWorld().getName())) {
                if (e.getTo().getBlockX() >= min.getX() && e.getTo().getBlockX() <= max.getBlockX()
                        && e.getTo().getBlockY() >= min.getY() && e.getTo().getBlockY() <= max.getBlockY()
                        && e.getTo().getBlockZ() >= min.getZ() && e.getTo().getBlockZ() <= max.getBlockZ()) {
                    moveIntoArena = true;
                }
            }

            if (g.getTeam(e.getPlayer()) == null) {
                if (moveIntoArena) {
                    if (!e.getPlayer().isOp()) {
                        e.getPlayer().teleport(g.getPlugin().mapMan.getLobby());
                        g.getPlugin().teamMan.backToNormal(e.getPlayer());
                    }
                    return;
                }
            } else {
                if (!moveIntoArena) {
//                    g.getPlugin().getLogger().info("Debug: fuera de Area " +e.getTo() + "  " + g.getArena().area.getMinimumPoint() + " / " + g.getArena().area.getMaximumPoint());
                    g.messageAll(e.getPlayer().getName() + " ha caído fuera de la arena.");
                    g.moveToSpawn(e.getPlayer());
                }
            }

            if (g.getArena().capturePoint.getBlockX() == e.getTo().getBlockX()
                    && g.getArena().capturePoint.getBlockY() == e.getTo().getBlockY()
                    && g.getArena().capturePoint.getBlockZ() == e.getTo().getBlockZ()
                    && g.getArena().capturePoint.getWorld().getName().equals(e.getTo().getWorld().getName())) {
                g.moveAllToSpawn();
                g.messageAll(ChatColor.GOLD + e.getPlayer().getDisplayName() + " captura el punto");
                int score = g.getPlugin().teamMan.getScore(e.getPlayer()).getScore();
                g.getPlugin().teamMan.getScore(e.getPlayer()).setScore(score + reward.get(round));
                g.playSoundAll(Sound.EXPLODE);

                /*
                 Location pointLoc = e.getTo();
                 pointLoc.setY(e.getTo().getY() - round);
                 pointLoc.getBlock().setType(Material.WOOL);
                 pointLoc.getBlock().setData(g.getPlugin().teamMan.getDyeColor(e.getPlayer()).getData());
                 */
                g.announsePoint();
                round++;
                tickCounter = 0;
            }

        }
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:52,代码来源:Round.java

示例11: calculateVolume

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
/**
 * Calculate the volume of the region (could be expensive for polygon regions).
 * @return Number of blocks in the region
 */
private long calculateVolume() {
	// Use own calculation for polygon regions, as WorldGuard does not implement it and returns 0
	ProtectedRegion region = getRegion();
	if(region instanceof ProtectedPolygonalRegion) {
		BlockVector min = region.getMinimumPoint();
		BlockVector max = region.getMaximumPoint();

		// Exact, but slow algorithm
		if(getWidth() * getDepth() < 100) {
			long surface = 0;
			for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
				for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
					if (region.contains(x, min.getBlockY(), z)) {
						surface++;
					}
				}
			}
			return surface * getHeight();
		}
		// Estimate, but quick algorithm
		else {
			List<BlockVector2D> points = region.getPoints();
			int numPoints = points.size();
			if(numPoints < 3) {
				return 0;
			}

			double area = 0;
			int x1, x2, z1, z2;
			for(int i = 0; i <= numPoints - 2; i++) {
				x1 = points.get(i).getBlockX();
				z1 = points.get(i).getBlockZ();

				x2 = points.get(i + 1).getBlockX();
				z2 = points.get(i + 1).getBlockZ();

				area = area + ((z1 + z2) * (x1 - x2));
			}

			x1 = points.get(numPoints - 1).getBlockX();
			z1 = points.get(numPoints - 1).getBlockZ();
			x2 = points.get(0).getBlockX();
			z2 = points.get(0).getBlockZ();

			area = area + ((z1 + z2) * (x1 - x2));
			area = Math.ceil(Math.abs(area) / 2);
			return (long)(area * getHeight());
		}
	} else {
		return region.volume();
	}
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:57,代码来源:GeneralRegion.java

示例12: run

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void run() {
	boolean finish = !player.isOnline();
	
	if (player.isOnline()) {
		Player bukkitPlayer = player.getBukkitPlayer();
		
		// Stores the current wool data
		byte data;
		
		if (currentRepetitions % 2 == 0) {
			data = LIME_WOOL_DATA;
		} else {
			data = RED_WOOL_DATA;
		}
		
		finish = currentRepetitions > REPETITIONS;
		Iterator<BlockVector> iterator = region.iterator();
		
		while (iterator.hasNext()) {
			BlockVector vec = iterator.next();
			
			int x = vec.getBlockX();
			int y = vec.getBlockY();
			int z = vec.getBlockZ();
			
			Location location = new Location(world, x, y, z);
			
			if (!finish) {
				bukkitPlayer.sendBlockChange(location, Material.WOOL, data);
			} else {
				Block block = world.getBlockAt(location);
				
				Material material = block.getType();
				data = block.getData();
				
				bukkitPlayer.sendBlockChange(location, material, data);
			}
		}
	}
	
	if (finish) {
		BukkitTask task = tasks.get(player);
		task.cancel();
		
		tasks.remove(player);
	}
	
	++currentRepetitions;
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:52,代码来源:RegionVisualizer.java

示例13: toBukkit

import com.sk89q.worldedit.BlockVector; //导入方法依赖的package包/类
protected Location toBukkit(BlockVector block) {
	return new Location(world, block.getBlockX(), block.getBlockY(), block.getBlockZ());
}
 
开发者ID:CodingBadgers,项目名称:MineKart,代码行数:4,代码来源:Racecourse.java


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