Java Code Examples for com.sk89q.worldedit.EditSession#nullBlock()
The following examples show how to use
com.sk89q.worldedit.EditSession#nullBlock() .
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: FaweRegionExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public BaseBlock getBlock(Vector position) { if (!contains(position)) { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } return EditSession.nullBlock; } return super.getBlock(position); }
Example 2
Source File: FaweRegionExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public BaseBlock getLazyBlock(Vector position) { if (!contains(position)) { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } return EditSession.nullBlock; } return super.getLazyBlock(position); }
Example 3
Source File: FaweRegionExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public BaseBlock getLazyBlock(int x, int y, int z) { if (!contains(x, y, z)) { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } return EditSession.nullBlock; } return super.getLazyBlock(x, y, z); }
Example 4
Source File: ProcessedWEExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public BaseBlock getLazyBlock(int x, int y, int z) { if (!limit.MAX_CHECKS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS); return EditSession.nullBlock; } else { return extent.getLazyBlock(x, y, z); } }
Example 5
Source File: BlockArrayClipboard.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public BaseBlock getBlock(Vector position) { if (region.contains(position)) { int x = position.getBlockX() - mx; int y = position.getBlockY() - my; int z = position.getBlockZ() - mz; return IMP.getBlock(x, y, z); } return EditSession.nullBlock; }
Example 6
Source File: ForgePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlockInHand() { ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage()); }
Example 7
Source File: ForgePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlockInHand() { ItemStack is = this.player.getCurrentEquippedItem(); return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage()); }
Example 8
Source File: ForgePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlockInHand() { ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage()); }
Example 9
Source File: ForgePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlockInHand() { ItemStack is = this.player.getCurrentEquippedItem(); return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage()); }
Example 10
Source File: ForgePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlockInHand() { ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage()); }
Example 11
Source File: ForgePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlockInHand() { ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage()); }
Example 12
Source File: EmptyExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public BaseBlock getBlock(Vector position) { return EditSession.nullBlock; }
Example 13
Source File: EmptyExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public BaseBlock getLazyBlock(Vector position) { return EditSession.nullBlock; }
Example 14
Source File: EmptyClipboard.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getBlock(Vector position) { return EditSession.nullBlock; }
Example 15
Source File: EmptyClipboard.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public BaseBlock getLazyBlock(Vector position) { return EditSession.nullBlock; }
Example 16
Source File: HeightMap.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public int apply(int[] data) throws WorldEditException { checkNotNull(data); Vector minY = region.getMinimumPoint(); int originX = minY.getBlockX(); int originY = minY.getBlockY(); int originZ = minY.getBlockZ(); int maxY = region.getMaximumPoint().getBlockY(); BaseBlock fillerAir = EditSession.nullBlock; int blocksChanged = 0; BaseBlock tmpBlock = EditSession.nullBlock; // Apply heightmap int index = 0; for (int z = 0; z < height; ++z) { int zr = z + originZ; for (int x = 0; x < width; ++x, index++) { int curHeight = this.data[index]; if (this.invalid != null && this.invalid[index]) continue; int newHeight = Math.min(maxY, data[index]); int xr = x + originX; // Depending on growing or shrinking we need to start at the bottom or top if (newHeight > curHeight) { // Set the top block of the column to be the same type (this might go wrong with rounding) BaseBlock existing = session.getBlock(xr, curHeight, zr); // Skip water/lava if (!FaweCache.isLiquidOrGas(existing.getId())) { int y0 = newHeight - 1; for (int setY = y0, getY = curHeight - 1; setY >= curHeight; setY--, getY--) { BaseBlock get = session.getBlock(xr, getY, zr); if (get != EditSession.nullBlock) tmpBlock = get; session.setBlock(xr, setY, zr, tmpBlock); ++blocksChanged; } session.setBlock(xr, newHeight, zr, existing); ++blocksChanged; } } else if (curHeight > newHeight) { // Set the top block of the column to be the same type // (this could otherwise go wrong with rounding) session.setBlock(xr, newHeight, zr, session.getBlock(xr, curHeight, zr)); ++blocksChanged; // Fill rest with air for (int y = newHeight + 1; y <= curHeight; ++y) { session.setBlock(xr, y, zr, fillerAir); ++blocksChanged; } } } } return blocksChanged; }