Package org.bukkit.util

Examples of org.bukkit.util.Vector


        if(!EventUtil.passesFilter(event)) return;

        if (!(event.getVehicle() instanceof Minecart)) return;

        if (offRail > 0)
            ((Minecart) event.getVehicle()).setDerailedVelocityMod(new Vector(offRail, offRail, offRail));
        if(maxSpeed != 1)
            ((Minecart) event.getVehicle()).setMaxSpeed(((Minecart) event.getVehicle()).getMaxSpeed() * maxSpeed);
    }
View Full Code Here


    private String getCode() throws CodeNotFoundException {

        Sign sign = BukkitUtil.toSign(this.sign);

        Block above = sign.getLocation().add(new Vector(0, 1, 0)).getBlock();
        if (above.getType() == Material.CHEST) return getBookCode(above);
        Block below = sign.getLocation().add(new Vector(0, -1, 0)).getBlock();
        if (below.getType() == Material.CHEST) return getBookCode(below);

        org.bukkit.Location l = sign.getLocation();
        World w = l.getWorld();
View Full Code Here

    @Test
    public void testReverse() {

        Minecart cart = mock(Minecart.class);
        when(cart.getVelocity()).thenReturn(new Vector(0,1,0));
        CartUtil.reverse(cart);
        verify(cart).setVelocity(new Vector(0,-1,0));
    }
View Full Code Here

    @Test
    public void testStop() {

        Minecart cart = mock(Minecart.class);
        CartUtil.stop(cart);
        verify(cart).setVelocity(new Vector(0,0,0));
    }
View Full Code Here

        when(event.getAttacker()).thenReturn(mock(LivingEntity.class));
        new Uncrashable().onVehicleDestroy(event);

        verify(event).setCancelled(true);
        verify(boat).setVelocity(new Vector(0,0,0));
    }
View Full Code Here

            if(playerpos.get(e.getPlayer()) == null){
                playerpos.put(e.getPlayer(), e.getPlayer().getLocation().toVector());
                return;
            }
            Location l = e.getPlayer().getLocation();
            Vector v = playerpos.get(e.getPlayer());
            if(l.getBlockX() != v.getBlockX()  || l.getBlockZ() != v.getBlockZ()){
                l.setX(v.getBlockX() + .5);
                l.setZ(v.getBlockZ() + .5);
                l.setYaw(e.getPlayer().getLocation().getYaw());
                l.setPitch(e.getPlayer().getLocation().getPitch());
                e.getPlayer().teleport(l);
            }
        }
View Full Code Here

            int y2  =  v2.getBlockY();
            int z1  =  v1.getBlockZ();
            int z2  =  v2.getBlockZ();


            Vector s1 = new Vector((sp1<sp2)?sp1:sp2 , (y1<y2)?y1:y2 , (z1<z2)?z1:z2);
            Vector s2 = new Vector((sp1>sp2)?sp1:sp2 , (y1>y2)?y1:y2 , (z1>z2)?z1:z2);
            System.out.println(s1);
            System.out.println(s2);
            new DupeThread(s1,s2, maxx - v1.getBlockX(), 0, a).start();
        }
View Full Code Here

    Double locationY = location.getY();
    Double locationZ = location.getZ();
    Float pitch = location.getPitch();
    Float yaw = location.getYaw();
   
    Vector velocity = entity.getVelocity();
    Double velocityX = velocity.getX();
    Double velocityY = trimEntityVelocityY(velocity.getY());
    Double velocityZ = velocity.getZ();
   
    return valueOf(world, null, null, null, locationX, locationY, locationZ, null, null, pitch, yaw, velocityX, velocityY, velocityZ);
  }
View Full Code Here

    if (velocityY == null) throw new IllegalStateException(NAME_FULL_VELOCITYY + SPACE_WASNT_SET);
   
    Double velocityZ = ps.getVelocityZ();
    if (velocityZ == null) throw new IllegalStateException(NAME_FULL_VELOCITYZ + SPACE_WASNT_SET);
   
    return new Vector(velocityX, velocityY, velocityZ);
  }
View Full Code Here

    TeleportMixinCauseEngine.get().setMixinCausedTeleportIncoming(true);
    player.teleport(location);
    TeleportMixinCauseEngine.get().setMixinCausedTeleportIncoming(false);
   
    // Bukkit velocity
    Vector velocity = null;
    try
    {
      velocity = ps.asBukkitVelocity();
    }
    catch (Exception e)
View Full Code Here

TOP

Related Classes of org.bukkit.util.Vector

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.