Java Code Examples for com.nukkitx.math.vector.Vector3f#getY()
The following examples show how to use
com.nukkitx.math.vector.Vector3f#getY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BedrockMovePlayerTranslator.java From Geyser with MIT License | 6 votes |
public boolean isValidMove(GeyserSession session, MovePlayerPacket.Mode mode, Vector3f currentPosition, Vector3f newPosition) { if (mode != MovePlayerPacket.Mode.NORMAL) return true; double xRange = newPosition.getX() - currentPosition.getX(); double yRange = newPosition.getY() - currentPosition.getY(); double zRange = newPosition.getZ() - currentPosition.getZ(); if (xRange < 0) xRange = -xRange; if (yRange < 0) yRange = -yRange; if (zRange < 0) zRange = -zRange; if ((xRange + yRange + zRange) > 100) { session.getConnector().getLogger().debug(ChatColor.RED + session.getName() + " moved too quickly." + " current position: " + currentPosition + ", new position: " + newPosition); return false; } return true; }
Example 2
Source File: MoveEntityDeltaSerializer_v354.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); byte flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeByte(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }
Example 3
Source File: MoveEntityDeltaSerializer_v388.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); short flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeShortLE(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }
Example 4
Source File: MoveEntityDeltaSerializer_v340.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); byte flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeByte(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }
Example 5
Source File: MoveEntityDeltaSerializer_v313.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); byte flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeByte(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }
Example 6
Source File: MoveEntityDeltaSerializer_v361.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); byte flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeByte(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }
Example 7
Source File: MoveEntityDeltaSerializer_v332.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); byte flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeByte(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }
Example 8
Source File: MoveEntityDeltaSerializer_v291.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, MoveEntityDeltaPacket packet) { VarInts.writeUnsignedLong(buffer, packet.getRuntimeEntityId()); byte flags = 0; Vector3i movementDelta = packet.getMovementDelta(); Vector3f rotationDelta = packet.getRotationDelta(); flags |= movementDelta.getX() != 0 ? HAS_X : 0; flags |= movementDelta.getY() != 0 ? HAS_Y : 0; flags |= movementDelta.getZ() != 0 ? HAS_Z : 0; flags |= rotationDelta.getX() != 0 ? HAS_PITCH : 0; flags |= rotationDelta.getY() != 0 ? HAS_YAW : 0; flags |= rotationDelta.getZ() != 0 ? HAS_ROLL : 0; buffer.writeByte(flags); if ((flags & HAS_X) != 0) { VarInts.writeInt(buffer, movementDelta.getX()); } if ((flags & HAS_Y) != 0) { VarInts.writeInt(buffer, movementDelta.getY()); } if ((flags & HAS_Z) != 0) { VarInts.writeInt(buffer, movementDelta.getZ()); } if ((flags & HAS_PITCH) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getX()); } if ((flags & HAS_YAW) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getY()); } if ((flags & HAS_ROLL) != 0) { BedrockUtils.writeByteAngle(buffer, rotationDelta.getZ()); } }