Java Code Examples for org.bukkit.util.Vector#getBlockY()
The following examples show how to use
org.bukkit.util.Vector#getBlockY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CuboidBlockIterator.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
public CuboidBlockIterator(Vector min, Vector max) { this( min.getBlockX(), min.getBlockY(), min.getBlockZ(), max.getBlockX(), max.getBlockY(), max.getBlockZ()); }
Example 2
Source File: Region.java From WildernessTp with MIT License | 5 votes |
public boolean contains(Vector position) { double x = position.getX(); double y = position.getY(); double z = position.getZ(); Vector min = getMinimumPoint(); Vector max = getMaximumPoint(); if (x >= min.getBlockX() && x <= max.getBlockX() && y >= min.getBlockY() && y <= max.getBlockY() && z >= min.getBlockZ() && z <= max.getBlockZ()) return true; else return false; }
Example 3
Source File: ArenaDuplicator.java From Survival-Games with GNU General Public License v3.0 | 5 votes |
public void startDupe(Vector v1, Vector v2){ int factor = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors(); factor = 4; int xspan = v2.getBlockX() - v1.getBlockX(); int maxx = GameManager.getInstance().getGame(1).getArena().getMax().getBlockX(); for(Game g: GameManager.getInstance().getGames()){ Location a1 = g.getArena().getMin(); Location a2 = g.getArena().getMax(); if(a1.getBlockX()>maxx){ maxx = a1.getBlockX(); } if(a2.getBlockX()>maxx){ maxx = a2.getBlockX(); } } int divf = xspan / factor; background = new background(Math.abs(v2.getBlockX()-v1.getBlockX()) * Math.abs(v2.getBlockY()-v1.getBlockY()) * Math.abs(v1.getBlockZ()-v2.getBlockZ())); background.start(); for(int a = 1; a<=factor; a++){ System.out.println(xspan); int sp1 = divf * a + v1.getBlockX(); int sp2 = divf * (a+1) + v1.getBlockX(); int y1 = v1.getBlockY(); int y2 = v2.getBlockY(); int z1 = v1.getBlockZ(); int z2 = v2.getBlockZ(); Vector s1 = new Vector((sp1<sp2)?sp1:sp2 , (y1<y2)?y1:y2 , (z1<z2)?z1:z2); Vector s2 = new Vector((sp1>sp2)?sp1:sp2 , (y1>y2)?y1:y2 , (z1>z2)?z1:z2); System.out.println(s1); System.out.println(s2); new DupeThread(s1,s2, maxx - v1.getBlockX(), 0, a).start(); } }
Example 4
Source File: Utils.java From AreaShop with GNU General Public License v3.0 | 5 votes |
/** * 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(WorldEditSelection selection) { // Get all regions inside or intersecting with the WorldEdit selection of the player World world = selection.getWorld(); RegionManager regionManager = AreaShop.getInstance().getRegionManager(world); ArrayList<ProtectedRegion> result = new ArrayList<>(); Location selectionMin = selection.getMinimumLocation(); Location selectionMax = selection.getMaximumLocation(); for(ProtectedRegion region : regionManager.getRegions().values()) { Vector regionMin = AreaShop.getInstance().getWorldGuardHandler().getMinimumPoint(region); Vector regionMax = AreaShop.getInstance().getWorldGuardHandler().getMaximumPoint(region); 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; }
Example 5
Source File: BlockVectors.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
static BlockVector center(Vector blockPos) { return new BlockVector( blockPos.getBlockX() + 0.5, blockPos.getBlockY() + 0.5, blockPos.getBlockZ() + 0.5); }
Example 6
Source File: BlockRegion.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
public BlockRegion(Vector block) { this.location = new Vector(block.getBlockX(), block.getBlockY(), block.getBlockZ()); }
Example 7
Source File: BlockRegion.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean contains(Vector point) { return this.location.getBlockX() == point.getBlockX() && this.location.getBlockY() == point.getBlockY() && this.location.getBlockZ() == point.getBlockZ(); }
Example 8
Source File: BlockRegion.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
public BlockRegion(Vector block) { this.location = new Vector(block.getBlockX(), block.getBlockY(), block.getBlockZ()); }
Example 9
Source File: BlockRegion.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean contains(Vector point) { return this.location.getBlockX() == point.getBlockX() && this.location.getBlockY() == point.getBlockY() && this.location.getBlockZ() == point.getBlockZ(); }
Example 10
Source File: DeathContext.java From UHC with MIT License | 4 votes |
public String blockCoords() { final Vector coords = rawCoords(); return coords.getBlockX() + "," + coords.getBlockY() + "," + coords.getBlockZ(); }
Example 11
Source File: FastAsyncWorldEditWorldGuardHandler.java From AreaShop with GNU General Public License v3.0 | 4 votes |
@Override public ProtectedCuboidRegion createCuboidRegion(String name, Vector corner1, Vector corner2) { return new ProtectedCuboidRegion(name, new BlockVector(corner1.getBlockX(), corner1.getBlockY(), corner1.getBlockZ()), new BlockVector(corner2.getBlockX(), corner2.getBlockY(), corner2.getBlockZ())); }
Example 12
Source File: BlockRegion.java From CardinalPGM with MIT License | 4 votes |
@Override public boolean contains(Vector vector) { return vector.getBlockX() == getVector().getBlockX() && vector.getBlockY() == getVector().getBlockY() && vector.getBlockZ() == getVector().getBlockZ(); }