本文整理汇总了Java中com.sk89q.worldedit.BlockVector类的典型用法代码示例。如果您正苦于以下问题:Java BlockVector类的具体用法?Java BlockVector怎么用?Java BlockVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockVector类属于com.sk89q.worldedit包,在下文中一共展示了BlockVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isaVenda
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
public static boolean isaVenda(World w, BlockVector bvmin, BlockVector bvmax) {
Location min = new Location(w, bvmin.getX(), bvmin.getY(), bvmin.getZ());
Location max = new Location(w, bvmax.getX(), bvmax.getY(), bvmax.getZ());
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
Block b = w.getBlockAt(x, y, z);
if (b.getType() == Material.SIGN_POST && ((Sign) b.getState()).getLine(0).equals(getMensagem("placa_venda.linha1"))) {
return true;
}
}
}
}
return false;
}
示例2: delTerreno
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
public static void delTerreno(World w, BlockVector bvmin, BlockVector bvmax) {
Location min = new Location(w, bvmin.getX(), bvmin.getY(), bvmin.getZ());
Location max = new Location(w, bvmax.getX(), bvmax.getY(), bvmax.getZ());
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
Block b = w.getBlockAt(x, y, z);
List<String> s = Main.getPlugin().getConfig().getStringList("SafeBlocks");
if (!s.contains(Integer.toString(b.getTypeId()))) {
b.setType(Material.AIR);
}
}
}
}
}
示例3: setBlockVectors
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
private void setBlockVectors() {
int minX = location.getBlockX() - ((sizeX - 1) / 2);
int minY = location.getBlockY() - ((sizeY - 1) / 2);
int minZ = location.getBlockZ() - ((sizeZ - 1) / 2);
int maxX = location.getBlockX() + ((sizeX - 1) / 2);
int maxY = location.getBlockY() + ((sizeY - 1) / 2);
int maxZ = location.getBlockZ() + ((sizeZ - 1) / 2);
if (minY < 0) {
minY = 0;
}
if (maxY > 255) {
maxY = 255;
}
this.min = new BlockVector(minX, minY, minZ);
this.max = new BlockVector(maxX, maxY, maxZ);
}
示例4: 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;
}
示例5: toArray
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
@Override
public <T> T[] toArray(T[] array) {
int size = size();
if (array == null || array.length < size) {
array = (T[]) new BlockVector[size];
}
int index = 0;
for (int i = 0; i < size; i++) {
index = set.nextSetBit(index);
int b1 = (index & 0xFF);
int b2 = ((byte) (index >> 8)) & 0x7F;
int b3 = ((byte) (index >> 15)) & 0xFF;
int b4 = ((byte) (index >> 23)) & 0xFF;
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
int y = b1;
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
array[i] = (T) new BlockVector(x, y, z);
index++;
}
return array;
}
示例6: getChunks
import com.sk89q.worldedit.BlockVector; //导入依赖的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;
}
示例7: EllipsoidRegionSelector
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
/**
* Create a new selector from the given selector.
*
* @param oldSelector the old selector
*/
public EllipsoidRegionSelector(RegionSelector oldSelector) {
this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());
if (oldSelector instanceof EllipsoidRegionSelector) {
final EllipsoidRegionSelector ellipsoidRegionSelector = (EllipsoidRegionSelector) oldSelector;
region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion());
} else {
Region oldRegion;
try {
oldRegion = oldSelector.getRegion();
} catch (IncompleteRegionException e) {
return;
}
BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector();
BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector();
Vector center = pos1.add(pos2).divide(2).floor();
region.setCenter(center);
region.setRadius(pos2.subtract(center));
}
}
示例8: actPrimary
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
World world = (World) clicked.getExtent();
int initialType = world.getBlockType(clicked.toVector());
if (initialType == BlockID.AIR) {
return true;
}
if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) {
return true;
}
EditSession editSession = session.createEditSession(player);
try {
recurse(server, editSession, world, clicked.toVector().toBlockVector(),
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
editSession.flushQueue();
session.remember(editSession);
return true;
}
示例9: getPBregion
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
/**
* returns a calculated ProtectedCuboidRegion from given params.
*
* @param loc Location of the protection block
* @param length The lenght of the region
* @param height The height of the region
* @param width The width of the reguion
* @param playerName The Owner of the region.
* @return ProtectedCuboidRegion
*/
public ProtectedCuboidRegion getPBregion(Location loc, int length, int height, int width, String playerName) {
BlockVector min = new BlockVector(loc.getBlockX() - ((length - 1) / 2),
0,
loc.getBlockZ() - ((width - 1) / 2));
BlockVector max = new BlockVector(loc.getBlockX() + ((length - 1) / 2),
255,
loc.getBlockZ() + ((width - 1) / 2));
if (height != 0) {
min = min.setY(loc.getBlockY() - ((height - 1) / 2)).toBlockVector();
max = max.setY(loc.getBlockY() + ((height - 1) / 2)).toBlockVector();
}
ProtectedCuboidRegion region = new ProtectedCuboidRegion("ps"
+ loc.getBlockX() + "x"
+ loc.getBlockY() + "y"
+ loc.getBlockZ() + "z", min, max);
DefaultDomain dd = new DefaultDomain();
dd.addPlayer(playerName);
region.setOwners(dd);
return region;
}
示例10: decode
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BlockVector decode(BsonReader reader, DecoderContext decoderContext) {
int x = 0;
int y = 0;
int z = 0;
reader.readStartDocument();
while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
String name = reader.readName();
if ("x".equals(name))
x = reader.readInt32();
else if ("y".equals(name))
y = reader.readInt32();
else if ("z".equals(name))
z = reader.readInt32();
else
reader.skipValue();
}
reader.readEndDocument();
return new BlockVector(x, y, z);
}
示例11: isIslandIntersectingSpawn
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
public static boolean isIslandIntersectingSpawn(Location islandLocation) {
log.entering(CN, "isIslandIntersectingSpawn", islandLocation);
try {
int r = Settings.general_spawnSize;
if (r == 0) {
return false;
}
ProtectedRegion spawn = new ProtectedCuboidRegion("spawn", new BlockVector(-r, 0, -r), new BlockVector(r, 255, r));
ProtectedCuboidRegion islandRegion = getIslandRegion(islandLocation);
return !islandRegion.getIntersectingRegions(Collections.singletonList(spawn)).isEmpty();
} catch (Exception e) {
log.log(Level.SEVERE, "Unable to locate intersecting regions", e);
return false;
} finally {
log.exiting(CN, "isIslandIntersectingSpawn");
}
}
示例12: calculateSpawnLocations
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
private void calculateSpawnLocations() {
spawningBarriers.clear();
for (Floor floor : game.getFloors()) {
Region region = floor.getRegion();
RegionIterator iterator = new RegionIterator(region);
while (iterator.hasNext()) {
BlockVector vector = iterator.next();
Location location = BukkitUtil.toLocation(game.getWorld(), vector);
Block block = location.getBlock();
if (block.getType() != Material.BARRIER) {
continue;
}
spawningBarriers.add(vector.add(0.5, 0.5, 0.5));
}
}
Collections.shuffle(spawningBarriers);
}
示例13: getWithin
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
public ArrayList<ABPortal> getWithin(final World world, final BlockVector min, final BlockVector max) {
final RegionManager rm = wg.getRegionManager(world);
if ( rm == null )
return null;
ProtectedCuboidRegion region = new ProtectedCuboidRegion(null, min, max);
final ArrayList<ABPortal> out = new ArrayList<ABPortal>();
for (final ProtectedRegion r: rm.getApplicableRegions(region)) {
final String key = r.getId();
if ( !key.startsWith("abyss-") )
continue;
final UUID uid = ParseUtils.tryUUID(key.substring(6));
if ( uid == null )
continue;
final ABPortal portal = allPortals.get(uid);
if ( portal != null )
out.add(portal);
}
return out;
}
示例14: protect
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
public void protect(Player send, String p) throws SQLException, InvalidFlagFormat, ProtectionDatabaseException
{
Config cfg = new Config();
World w = cfg.getFarmWorld();
DatabaseManager db = new DatabaseManager();
BlockVector l1 = convertToSk89qBV(db.getVectorLeft(p, w));
BlockVector l2 = convertToSk89qBV(db.getVectorRight(p, w));
DefaultDomain owners = new DefaultDomain();
ProtectedRegion pr = new ProtectedCuboidRegion(p + "-Farm", l1.toBlockVector(), l2.toBlockVector());
owners.addPlayer(p);
pr.setOwners(owners);
pr.setPriority(100);
pr.setFlag(DefaultFlag.GREET_MESSAGE, DefaultFlag.GREET_MESSAGE.parseInput(getWorldGuard(), send, ChatColor.GOLD + "** " + ChatColor.DARK_AQUA + "You're entering a protected area" + ChatColor.GOLD + " **"));
pr.setFlag(DefaultFlag.FAREWELL_MESSAGE, DefaultFlag.FAREWELL_MESSAGE.parseInput(getWorldGuard(), send, ChatColor.GOLD + "** " + ChatColor.DARK_AQUA + "You're leaving a protected area" + ChatColor.GOLD + " **"));
pr.setFlag(DefaultFlag.ENTRY, DefaultFlag.ENTRY.parseInput(getWorldGuard(), send, "deny"));
getWorldGuard().getRegionManager(w).addRegion(pr);
getWorldGuard().getRegionManager(w).save();
}
示例15: regionAt
import com.sk89q.worldedit.BlockVector; //导入依赖的package包/类
public Boolean regionAt(Chunk chunk) {
String regionName = this.randomRegionName();
int x1 = chunk.getX() << 4,
z1 = chunk.getZ() << 4,
y1 = 0;
int x2 = x1 + 15,
z2 = z1 + 15,
y2 = chunk.getWorld().getMaxHeight();
BlockVector point1 = new BlockVector(x1, y1, z1);
BlockVector point2 = new BlockVector(x2, y2, z2);
ProtectedCuboidRegion chunkRegion = new ProtectedCuboidRegion(regionName, point1, point2);
// Check over the regions, and ensure that none are in the configuration to ignore
ApplicableRegionSet regions = WGBukkit.getRegionManager(chunk.getWorld()).getApplicableRegions(chunkRegion);
for (ProtectedRegion region : regions) {
if (Config.get().worldGuardIgnoreRegions.contains(region.getId())) continue;
return true;
}
return false;
}