Package com.sk89q.worldedit.util

Examples of com.sk89q.worldedit.util.Location


    }

    @Override
    public Location getLocation() {
        Vector position = new Vector(this.player.posX, this.player.posY, this.player.posZ);
        return new Location(
                ForgeWorldEdit.inst.getWorld(this.player.worldObj),
                position,
                this.player.cameraYaw,
                this.player.cameraPitch);
    }
View Full Code Here


            return entity.getExtent();
        }

        @Override
        public boolean remove() {
            Location location = entity.getLocation();
            BaseEntity state = entity.getState();
            boolean success = entity.remove();
            if (state != null && success) {
                changeSet.add(new EntityRemove(location, state));
            }
View Full Code Here

        if (entity != null) {
            Vector position = new Vector(entity.posX, entity.posY, entity.posZ);
            float yaw = entity.rotationYaw;
            float pitch = entity.rotationPitch;

            return new Location(ForgeAdapter.adapt(entity.worldObj), position, yaw, pitch);
        } else {
            return new Location(NullWorld.getInstance());
        }
    }
View Full Code Here

     * @return the transformed location
     */
    public static Location transform(Location location, Transform transform) {
        checkNotNull(location);
        checkNotNull(transform);
        return new Location(location.getExtent(), transform.apply(location.toVector()), location.getDirection());
    }
View Full Code Here

    public void handleBlockInteract(BlockInteractEvent event) {
        // Create a proxy actor with a potentially different world for
        // making changes to the world
        Actor actor = createProxyActor(event.getCause());

        Location location = event.getLocation();
        Vector vector = location.toVector();

        // At this time, only handle interaction from players
        if (actor instanceof Player) {
            Player player = (Player) actor;
            LocalSession session = worldEdit.getSessionManager().get(actor);

            if (event.getType() == Interaction.HIT) {
                if (player.getItemInHand() == getConfiguration().wandItem) {
                    if (!session.isToolControlEnabled()) {
                        return;
                    }

                    if (!actor.hasPermission("worldedit.selection.pos")) {
                        return;
                    }

                    RegionSelector selector = session.getRegionSelector(player.getWorld());

                    if (selector.selectPrimary(location.toVector(), ActorSelectorLimits.forActor(player))) {
                        selector.explainPrimarySelection(actor, session, vector);
                    }

                    event.setCancelled(true);
                    return;
View Full Code Here

     */
    public static Location toLocation(Extent extent, ListTag positionTag, ListTag directionTag) {
        checkNotNull(extent);
        checkNotNull(positionTag);
        checkNotNull(directionTag);
        return new Location(
                extent,
                positionTag.asDouble(0), positionTag.asDouble(1), positionTag.asDouble(2),
                (float) directionTag.asDouble(0), (float) directionTag.asDouble(1));
    }
View Full Code Here

    public Location getLocation() {
        org.bukkit.entity.Entity entity = entityRef.get();
        if (entity != null) {
            return BukkitAdapter.adapt(entity.getLocation());
        } else {
            return new Location(NullWorld.getInstance());
        }
    }
View Full Code Here

            for (Tag tag : entityTags) {
                if (tag instanceof CompoundTag) {
                    CompoundTag compound = (CompoundTag) tag;
                    String id = compound.getString("id");
                    Location location = NBTConversions.toLocation(clipboard, compound.getListTag("Pos"), compound.getListTag("Rotation"));

                    if (!id.isEmpty()) {
                        BaseEntity state = new BaseEntity(id, compound);
                        clipboard.createEntity(location, state);
                    }
View Full Code Here

    @Override
    public boolean apply(Entity entity) throws WorldEditException {
        BaseEntity state = entity.getState();
        if (state != null) {
            Location location = entity.getLocation();
            Vector newPosition = transform.apply(location.toVector().subtract(from));
            Vector newDirection = transform.apply(location.getDirection()).subtract(transform.apply(Vector.ZERO)).normalize();
            Location newLocation = new Location(destination, newPosition.add(to), newDirection);

            // Some entities store their position data in NBT
            state = transformNbtData(state);

            boolean success = destination.createEntity(newLocation, state) != null;
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.util.Location

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.