Package be.demmel.jgws.packets

Examples of be.demmel.jgws.packets.Vector3


        readActions.add((packet, dataToDeserialize) -> {
          float x = dataToDeserialize.readFloat();
          float y = dataToDeserialize.readFloat();
          float z = dataToDeserialize.readFloat();

          Vector3 vector = new Vector3(x, y, z);
          try {
            field.set(packet, vector);
          } catch (IllegalArgumentException | IllegalAccessException e) {
            // should never happen
            LOGGER.error("Unexpected error: ", e);
View Full Code Here


          }
        });
      } else if (type == Vector3.class) {
        writeActions.add((packet, buffer) -> {
          try {
            Vector3 vector = (Vector3) field.get(packet);

            if (vector != null) {
              buffer.writeFloat(vector.getX());
              buffer.writeFloat(vector.getY());
              buffer.writeFloat(vector.getZ());
            } else {
              buffer.writeFloat(0);
              buffer.writeFloat(0);
              buffer.writeFloat(0);
            }
          } catch (IllegalArgumentException | IllegalAccessException e) {
            // should never happen
            LOGGER.error("Unexpected error: ", e);
            throw new RuntimeException(e);
          }
        });
      } else if (type == Vector4.class) {
        writeActions.add((packet, buffer) -> {
          try {
            Vector4 vector = (Vector4) field.get(packet);

            if (vector != null) {
              buffer.writeFloat(vector.getX());
              buffer.writeFloat(vector.getY());
              buffer.writeFloat(vector.getZ());
              buffer.writeFloat(vector.getA());
            } else {
              buffer.writeFloat(0);
              buffer.writeFloat(0);
              buffer.writeFloat(0);
              buffer.writeFloat(0);
View Full Code Here

TOP

Related Classes of be.demmel.jgws.packets.Vector3

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.