@Override public int getBlockIDAt(String wname, int x, int y, int z) { World w = getServer().getWorld(wname); if((w != null) && w.isChunkLoaded(x >> 4, z >> 4)) { return w.getBlockTypeIdAt(x, y, z); } return -1; }
public void run() { BlockToCheck btt; while(blocks_to_check.isEmpty() != true) { btt = blocks_to_check.pop(); Location loc = btt.loc; World w = loc.getWorld(); if(!w.isChunkLoaded(loc.getBlockX()>>4, loc.getBlockZ()>>4)) continue; int bt = w.getBlockTypeIdAt(loc); /* Avoid stationary and moving water churn */ if(bt == 9) bt = 8; if(btt.typeid == 9) btt.typeid = 8; if((bt != btt.typeid) || (btt.data != w.getBlockAt(loc).getData())) { String wn = getWorld(w).getName(); sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), btt.trigger); } } blocks_to_check = null; /* Kick next run, if one is needed */ startIfNeeded(); } public void startIfNeeded() {
public static boolean isAirOrWater(Location loc) { int id = loc.getWorld().getBlockTypeIdAt(loc); return id == 0 || id == 8 || id == 9; }
private boolean isEmptySpace(World world, int x, int y, int z) { int type1 = world.getBlockTypeIdAt(x, y, z); int type2 = world.getBlockTypeIdAt(x, y, z); return plugin.getSettingsManager().isThroughType(type1) && plugin.getSettingsManager().isThroughType(type2); }
private boolean blockIsSafe(World world, int x, int y, int z) { int head = world.getBlockTypeIdAt(x, y + 1, z); int feet = world.getBlockTypeIdAt(x, y, z); return (plugin.getSettingsManager().isThroughType(head)) && (plugin.getSettingsManager().isThroughType((feet))); } }
/** * Spawn all the creatures */ public void doCreatureSpawns(Field field) { int minx = field.getX() - field.getRadius(); int maxx = field.getX() + field.getRadius(); int minz = field.getZ() - field.getRadius(); int maxz = field.getZ() + field.getRadius(); int miny = field.getY() - (int) Math.floor(((double) field.getHeight()) / 2); int maxy = field.getY() + (int) Math.ceil(((double) field.getHeight()) / 2); Random r = new Random(); FieldSettings fs = field.getSettings(); for (int i = 0; i < fs.getCreatureCount(); i++) { int x = r.nextInt(maxx - minx) + minx; int z = r.nextInt(maxz - minz) + minz; int y = field.getY(); World world = field.getBlock().getWorld(); int floorType = world.getBlockTypeIdAt(x, y, z); while (!plugin.getSettingsManager().isThroughType(floorType) && y < 256) { floorType = world.getBlockTypeIdAt(x, ++y, z); } EntityType entity = getEntity(fs); if (entity == null || !entity.isAlive() || !entity.isSpawnable()) { continue; } world.spawnEntity(new Location(world, x, y, z), entity); } }
int sideOneMidId = world.getBlockTypeIdAt(minx, mid, z); int sideOne = world.getBlockTypeIdAt(minx, y, z); int sideOne = world.getBlockTypeIdAt(minx, y, z); int sideTwoMidId = world.getBlockTypeIdAt(maxx, mid, z); int sideTwo = world.getBlockTypeIdAt(maxx, y, z); int sideTwo = world.getBlockTypeIdAt(maxx, y, z); int sideOneMidId = world.getBlockTypeIdAt(x, mid, minz); int sideOne = world.getBlockTypeIdAt(x, y, minz); int sideOne = world.getBlockTypeIdAt(x, y, minz); int sideTwoMidId = world.getBlockTypeIdAt(x, mid, maxz); int sideTwo = world.getBlockTypeIdAt(x, y, maxz); int sideTwo = world.getBlockTypeIdAt(x, y, maxz);
int type = world.getBlockTypeIdAt(unbreakable.getX(), unbreakable.getY(), unbreakable.getZ());
/** * Prepares the land inside a forrester * * @param field * @param world */ public void prepareLand(Field field, World world) { int minx = field.getX() - field.getRadius(); int maxx = field.getX() + field.getRadius(); int minz = field.getZ() - field.getRadius(); int maxz = field.getZ() + field.getRadius(); int miny = field.getY() - (Math.max(field.getHeight() - 1, 0) / 2); int maxy = field.getY() + (Math.max(field.getHeight() - 1, 0) / 2); for (int x = minx; x < maxx; x += 4) { for (int z = minz; z <= maxz; z += 4) { for (int y = maxy; y > miny; y--) { int type = world.getBlockTypeIdAt(x, y, z); if (!isSeeThrough(type)) { prepareSpot(field, world, x, y, z, 4); } } } } }
if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z))) { free++; } else {
/** * @param player * @param field */ public void addFieldMark(Player player, Field field) { Visualization vis = visualizations.get(player.getName()); if (vis == null) { vis = new Visualization(); } vis.addField(field); World world = plugin.getServer().getWorld(field.getWorld()); if (world != null) { for (int y = 0; y < 256; y++) { int typeId = world.getBlockTypeIdAt(field.getX(), y, field.getZ()); if (plugin.getSettingsManager().isThroughType(typeId)) { vis.addBlock(new Location(world, field.getX(), y, field.getZ()), plugin.getSettingsManager().getVisualizeMarkBlock().getTypeId(), (byte) 0); } } } visualizations.put(player.getName(), vis); }
int id = player.getWorld().getBlockTypeIdAt(x, y, z);
int type = world.getBlockTypeIdAt(vec.getX(), vec.getY(), vec.getZ()); int typeabove = world.getBlockTypeIdAt(vec.getX(), vec.getY() + 1, vec.getZ());
int type = world.getBlockTypeIdAt(x, y, z);
int type = world.getBlockTypeIdAt(gb.getX(), gb.getY() + count, gb.getZ());
int type = world.getBlockTypeIdAt(x, y, z);
int type = world.getBlockTypeIdAt(tb.getX(), tb.getY() + count, tb.getZ());