@Override public BlockState getBlock(BlockVector3 position) { return BlockTypes.AIR.getDefaultState(); }
@Override public BlockState getBlock(BlockVector3 position) { return BlockTypes.AIR.getDefaultState(); }
/** * Get a pattern that creates melons. * * @return a melon pattern */ public static Pattern getMelonPattern() { return new BlockPattern(BlockTypes.MELON.getDefaultState()); } }
@Override public BaseBlock apply(BlockVector3 pos) { BaseBlock block = buffer.get(pos); if (block != null) { return block; } else { return BlockTypes.AIR.getDefaultState().toBaseBlock(); } }
/** * Get a pattern that creates pumpkins with different faces. * * @return a pumpkin pattern */ public static Pattern getPumpkinPattern() { return new BlockPattern(BlockTypes.PUMPKIN.getDefaultState()); }
@Override public Operation resume(RunContext run) throws WorldEditException { if (!dirtyChunks.isEmpty()) { world.fixAfterFastMode(dirtyChunks); } if (!enabled && postEditSimulation) { Iterator<BlockVector3> positionIterator = positions.iterator(); while (run.shouldContinue() && positionIterator.hasNext()) { BlockVector3 position = positionIterator.next(); world.notifyAndLightBlock(position, BlockTypes.AIR.getDefaultState()); positionIterator.remove(); } return !positions.isEmpty() ? this : null; } return null; }
/** * Gets a full BlockState from this fuzzy one, filling in * properties with default values where necessary. * * @return The full BlockState */ public BlockState getFullState() { BlockState state = getBlockType().getDefaultState(); for (Map.Entry<Property<?>, Object> entry : getStates().entrySet()) { @SuppressWarnings("unchecked") Property<Object> objKey = (Property<Object>) entry.getKey(); state = state.with(objKey, entry.getValue()); } return getBlockType().getDefaultState(); }
@Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeCylinder(position, pattern, size, size, height, true); }
@Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeSphere(position, pattern, size, size, size, false); } }
@Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeCylinder(position, pattern, size, size, height, false); }
@Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeSphere(position, pattern, size, size, size, true); } }
@Override public boolean apply(BlockVector3 position) throws WorldEditException { BlockState blk = extent.getBlock(position); if (!separateStates) { blk = blk.getBlockType().getDefaultState(); } if (map.containsKey(blk)) { map.get(blk).increment(); } else { Countable<BlockState> c = new Countable<>(blk, 1); map.put(blk, c); distribution.add(c); } return true; }
/** * Get a pattern for plants to place inside a temperate environment. * * @return a pattern that places flora */ public static Pattern getTemperatePattern() { RandomPattern pattern = new RandomPattern(); pattern.add(new BlockPattern(BlockTypes.GRASS.getDefaultState()), 300); pattern.add(new BlockPattern(BlockTypes.POPPY.getDefaultState()), 5); pattern.add(new BlockPattern(BlockTypes.DANDELION.getDefaultState()), 5); return pattern; }
/** * Get a pattern for plants to place inside a desert environment. * * @return a pattern that places flora */ public static Pattern getDesertPattern() { RandomPattern pattern = new RandomPattern(); pattern.add(new BlockPattern(BlockTypes.DEAD_BUSH.getDefaultState()), 30); pattern.add(new BlockPattern(BlockTypes.CACTUS.getDefaultState()), 20); pattern.add(new BlockPattern(BlockTypes.AIR.getDefaultState()), 300); return pattern; }
@Override public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { final ItemType typeId = getItemInHand(handSide).getType(); if (typeId.hasBlockType()) { return typeId.getBlockType().getDefaultState().toBaseBlock(); } else { throw new NotABlockException(); } }
@Override public BaseBlock getBlock(BlockVector3 position) throws DataException { int id = getBlockID(position); int data = getBlockData(position); BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data); if (state == null) { WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk."); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } CompoundTag tileEntity = getBlockTileEntity(position); if (tileEntity != null) { return state.toBaseBlock(tileEntity); } return state.toBaseBlock(); }
@Override public BaseBlock getFullBlock(BlockVector3 position) { if (region.contains(position)) { BlockVector3 v = position.subtract(region.getMinimumPoint()); BaseBlock block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { return block; } } return BlockTypes.AIR.getDefaultState().toBaseBlock(); }
@Override public BlockState getBlock(BlockVector3 position) { if (region.contains(position)) { BlockVector3 v = position.subtract(region.getMinimumPoint()); BaseBlock block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { return block.toImmutableState(); } } return BlockTypes.AIR.getDefaultState(); }
@Override public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws WorldEditException { BlockType existing = getExtent().getBlock(position).getBlockType(); if (existing.getMaterial().hasContainer()) { world.clearContainerBlockContents(position); // Clear the container block so that it doesn't drop items } else if (existing == BlockTypes.ICE) { world.setBlock(position, BlockTypes.AIR.getDefaultState()); // Ice turns until water so this has to be done first } return super.setBlock(position, block); }
@Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { try { BlockVector3 spot = BlockVector3.at(x, y - 1, z); if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) { getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState()); } } catch (WorldEditException e) { e.printStackTrace(); } setPosition(Vector3.at(x + 0.5, y, z + 0.5)); }