Package org.spout.math.vector

Examples of org.spout.math.vector.Vector3f


    final boolean looked = entity.getPhysics().isRotationDirty();

    final int lastX = protocolifyPosition(prevTransform.getPosition().getX());
    final int lastY = protocolifyPosition(prevTransform.getPosition().getY());
    final int lastZ = protocolifyPosition(prevTransform.getPosition().getZ());
    final Vector3f lastAxesAngles = prevTransform.getRotation().getAxesAngleDeg();
    final int lastYaw = protocolifyYaw(lastAxesAngles.getY());
    final int lastPitch = protocolifyPitch(lastAxesAngles.getX());

    final int newX = protocolifyPosition(newTransform.getPosition().getX());
    final int newY = protocolifyPosition(newTransform.getPosition().getY());
    final int newZ = protocolifyPosition(newTransform.getPosition().getZ());
    final Vector3f newAxesAngles = newTransform.getRotation().getAxesAngleDeg();
    final int newYaw = protocolifyYaw(newAxesAngles.getY());
    final int newPitch = protocolifyPitch(newAxesAngles.getX());

    final int deltaX = newX - lastX;
    final int deltaY = newY - lastY;
    final int deltaZ = newZ - lastZ;
    final int deltaYaw = newYaw - lastYaw;
View Full Code Here


  public static Vector3f getProtocolVelocity(Vector3f velocity) {
    final float x = velocity.getX() * 32000;
    final float y = velocity.getY() * 32000;
    final float z = velocity.getZ() * 32000;
    return new Vector3f(x, y, z);
  }
View Full Code Here

    int id = entity.getId();
    int x = VanillaByteBufUtils.protocolifyPosition(rm.convertX(entity.getPhysics().getPosition().getX()));
    int y = VanillaByteBufUtils.protocolifyPosition(rm.convertY(entity.getPhysics().getPosition().getY()));
    int z = VanillaByteBufUtils.protocolifyPosition(rm.convertZ(entity.getPhysics().getPosition().getZ()));
    final Vector3f axesAngles = entity.getPhysics().getRotation().getAxesAngleDeg();
    int r = VanillaByteBufUtils.protocolifyYaw(axesAngles.getY());
    int p = VanillaByteBufUtils.protocolifyPitch(axesAngles.getX());

    int item = 0;
    Slot hand = PlayerUtil.getHeldSlot(entity);
    if (hand != null && hand.get() != null) {
      item = hand.get().getMaterial().getId();
View Full Code Here

  @Override
  public void handleClient(ClientSession session, EntityRelativePositionMessage message) {
    Player player = session.getPlayer();
    World world = player.getWorld();
    Entity entity = world.getEntity(message.getEntityId());
    entity.getPhysics().translate(new Vector3f(message.getDeltaX(), message.getDeltaY(), message.getDeltaZ()));
  }
View Full Code Here

  @Override
  public List<Message> getSpawnMessages(Entity entity, RepositionManager rm) {
    List<Message> messages = new ArrayList<Message>(6);

    int entityId = entity.getId();
    Vector3f position = entity.getPhysics().getPosition().mul(32).floor();
    final Vector3f axesAngles = entity.getPhysics().getRotation().getAxesAngleDeg();
    int yaw = (int) (axesAngles.getY() * 32);
    int pitch = (int) (axesAngles.getX() * 32);
    List<Parameter<?>> parameters = this.getSpawnParameters(entity);
    if (parameters.isEmpty()) {
      parameters.add(new Parameter<Short>(Parameter.TYPE_SHORT, 1, (short) 1)); //Official expects some metadata to spawn
    }
    //TODO Headyaw
View Full Code Here

    float dx = ((float) (buffer.readByte() & 0xFF)) / 16.0F;
    float dy = ((float) (buffer.readByte() & 0xFF)) / 16.0F;
    float dz = ((float) (buffer.readByte() & 0xFF)) / 16.0F;

    return new PlayerBlockPlacementMessage(x, y, z, direction, new Vector3f(dx, dy, dz), heldItem, NullRepositionManager.getInstance());
  }
View Full Code Here

TOP

Related Classes of org.spout.math.vector.Vector3f

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.