Package com.sk89q.worldedit

Examples of com.sk89q.worldedit.WorldVector


        this.naturalOnly = naturalOnly;
    }

    @Override
    public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
        WorldVector min = new WorldVector(LocalWorldAdapter.adapt(editSession.getWorld()), position.subtract(size, size, size));
        Vector max = position.add(size, size + 10, size);
        Region region = new CuboidRegion(editSession.getWorld(), min, max);
        HeightMap heightMap = new HeightMap(editSession, region, naturalOnly);
        HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
        heightMap.applyFilter(filter, iterations);
View Full Code Here


   }

   @Override
   public WorldVector getPosition() {
      Coordinate c = player.getPosition();
      return new WorldVector(getWorld(), c.getX(), c.getY(), c.getZ());
   }
View Full Code Here

   /**
    * @see com.sk89q.worldedit.LocalPlayer#getPosition()
    */
   @Override
   public WorldVector getPosition() {
      return new WorldVector(getWorld(),player.posX,player.posY-1,player.posZ);
   }
View Full Code Here

    * @see com.sk89q.worldedit.LocalPlayer#getBlockTrace(int)
    */
   @Override
   public WorldVector getBlockTrace(int range) {
      MovingObjectPosition m = player.rayTrace(range, 1.0F);
      return new WorldVector(getWorld(),m.blockX,m.blockY,m.blockZ);
   }
View Full Code Here

            case BlockID.REDSTONE_WIRE:
                if (CraftBookPlugin.inst().getConfiguration().indirectRedstone) {

                    // power all blocks around the redstone wire on the same y level
                    // north/south
                    handleDirectWireInput(new WorldVector(w, x - 1, y, z), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + 1, y, z), block, oldLevel, newLevel);
                    // east/west
                    handleDirectWireInput(new WorldVector(w, x, y, z - 1), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x, y, z + 1), block, oldLevel, newLevel);

                    // Can be triggered from below
                    handleDirectWireInput(new WorldVector(w, x, y + 1, z), block, oldLevel, newLevel);

                    // Can be triggered from above (Eg, glass->glowstone like redstone lamps)
                    handleDirectWireInput(new WorldVector(w, x, y - 1, z), block, oldLevel, newLevel);
                } else {

                    int above = world.getBlockTypeIdAt(x, y + 1, z);

                    int westSide = world.getBlockTypeIdAt(x, y, z + 1);
                    int westSideAbove = world.getBlockTypeIdAt(x, y + 1, z + 1);
                    int westSideBelow = world.getBlockTypeIdAt(x, y - 1, z + 1);
                    int eastSide = world.getBlockTypeIdAt(x, y, z - 1);
                    int eastSideAbove = world.getBlockTypeIdAt(x, y + 1, z - 1);
                    int eastSideBelow = world.getBlockTypeIdAt(x, y - 1, z - 1);

                    int northSide = world.getBlockTypeIdAt(x - 1, y, z);
                    int northSideAbove = world.getBlockTypeIdAt(x - 1, y + 1, z);
                    int northSideBelow = world.getBlockTypeIdAt(x - 1, y - 1, z);
                    int southSide = world.getBlockTypeIdAt(x + 1, y, z);
                    int southSideAbove = world.getBlockTypeIdAt(x + 1, y + 1, z);
                    int southSideBelow = world.getBlockTypeIdAt(x + 1, y - 1, z);

                    // Make sure that the wire points to only this block
                    if (!BlockType.isRedstoneBlock(westSide) && !BlockType.isRedstoneBlock(eastSide)
                            && (!BlockType.isRedstoneBlock(westSideAbove) || westSide == 0 || above != 0)
                            && (!BlockType.isRedstoneBlock(eastSideAbove) || eastSide == 0 || above != 0)
                            && (!BlockType.isRedstoneBlock(westSideBelow) || westSide != 0)
                            && (!BlockType.isRedstoneBlock(eastSideBelow) || eastSide != 0)) {
                        // Possible blocks north / south
                        handleDirectWireInput(new WorldVector(w, x - 1, y, z), block, oldLevel, newLevel);
                        handleDirectWireInput(new WorldVector(w, x + 1, y, z), block, oldLevel, newLevel);
                        handleDirectWireInput(new WorldVector(w, x - 1, y - 1, z), block, oldLevel, newLevel);
                        handleDirectWireInput(new WorldVector(w, x + 1, y - 1, z), block, oldLevel, newLevel);
                    }

                    if (!BlockType.isRedstoneBlock(northSide) && !BlockType.isRedstoneBlock(southSide)
                            && (!BlockType.isRedstoneBlock(northSideAbove) || northSide == 0 || above != 0)
                            && (!BlockType.isRedstoneBlock(southSideAbove) || southSide == 0 || above != 0)
                            && (!BlockType.isRedstoneBlock(northSideBelow) || northSide != 0)
                            && (!BlockType.isRedstoneBlock(southSideBelow) || southSide != 0)) {
                        // Possible blocks west / east
                        handleDirectWireInput(new WorldVector(w, x, y, z - 1), block, oldLevel, newLevel);
                        handleDirectWireInput(new WorldVector(w, x, y, z + 1), block, oldLevel, newLevel);
                        handleDirectWireInput(new WorldVector(w, x, y - 1, z - 1), block, oldLevel, newLevel);
                        handleDirectWireInput(new WorldVector(w, x, y - 1, z + 1), block, oldLevel, newLevel);
                    }

                    // Can be triggered from below
                    handleDirectWireInput(new WorldVector(w, x, y + 1, z), block, oldLevel, newLevel);

                    // Can be triggered from above
                    handleDirectWireInput(new WorldVector(w, x, y - 1, z), block, oldLevel, newLevel);
                }
                return;
            case BlockID.REDSTONE_REPEATER_OFF:
            case BlockID.REDSTONE_REPEATER_ON:
            case BlockID.COMPARATOR_OFF:
            case BlockID.COMPARATOR_ON:
                Directional diode = (Directional) block.getState().getData();
                BlockFace f = diode.getFacing();
                handleDirectWireInput(new WorldVector(w, x + f.getModX(), y, z + f.getModZ()), block, oldLevel, newLevel);
                if(block.getRelative(f).getTypeId() != 0) {
                    handleDirectWireInput(new WorldVector(w, x + f.getModX(), y - 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX(), y + 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() + 1, y - 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() - 1, y - 1, z + f.getModZ()), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() + 1, y - 1, z + f.getModZ() + 1), block, oldLevel, newLevel);
                    handleDirectWireInput(new WorldVector(w, x + f.getModX() - 1, y - 1, z + f.getModZ() - 1), block, oldLevel, newLevel);
                }
                return;
            case BlockID.STONE_BUTTON:
            case BlockID.WOODEN_BUTTON:
            case BlockID.LEVER:
                Attachable button = (Attachable) block.getState().getData();
                if(button != null) {
                    BlockFace face = button.getAttachedFace();
                    if(face != null)
                        handleDirectWireInput(new WorldVector(w, x + face.getModX()*2, y, z + face.getModZ()*2), block, oldLevel, newLevel);
                }
        }

        // For redstone wires and repeaters, the code already exited this method
        // Non-wire blocks proceed

        handleDirectWireInput(new WorldVector(w, x - 1, y, z), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x + 1, y, z), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x - 1, y - 1, z), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x + 1, y - 1, z), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x, y, z - 1), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x, y, z + 1), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x, y - 1, z - 1), block, oldLevel, newLevel);
        handleDirectWireInput(new WorldVector(w, x, y - 1, z + 1), block, oldLevel, newLevel);

        // Can be triggered from below
        handleDirectWireInput(new WorldVector(w, x, y + 1, z), block, oldLevel, newLevel);

        // Can be triggered from above
        handleDirectWireInput(new WorldVector(w, x, y - 1, z), block, oldLevel, newLevel);
    }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.WorldVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.