List of usage examples for io.netty.buffer ByteBuf readFloat
public abstract float readFloat();
From source file:org.spout.api.util.ByteBufUtils.java
License:Open Source License
public static Vector2 readVector2(ByteBuf buf) { float x = buf.readFloat(); float z = buf.readFloat(); return new Vector2(x, z); }
From source file:org.spout.api.util.ByteBufUtils.java
License:Open Source License
public static Vector3 readVector3(ByteBuf buffer) { final float x = buffer.readFloat(); final float y = buffer.readFloat(); final float z = buffer.readFloat(); return new Vector3(x, y, z); }
From source file:org.spout.api.util.ByteBufUtils.java
License:Open Source License
public static Point readPoint(ByteBuf buffer) { UUID uuid = readUUID(buffer); World world = null;/*from w w w . j a v a2s. c om*/ if (Spout.getPlatform() == Platform.SERVER) { world = ((Server) Spout.getEngine()).getWorld(uuid); } else { World world1 = ((Client) Spout.getEngine()).getWorld(); if (world1.getUID().equals(uuid)) { world = world1; } } if (world == null) { throw new IllegalArgumentException("Unknown world with UUID " + uuid + (Spout.getPlatform() == Platform.CLIENT ? "Client UUID: " + ((Client) Spout.getEngine()).getWorld().getUID() + " World: " + ((Client) Spout.getEngine()).getWorld().getName() : "")); } final float x = buffer.readFloat(); final float y = buffer.readFloat(); final float z = buffer.readFloat(); return new Point(world, x, y, z); }
From source file:org.spout.api.util.ByteBufUtils.java
License:Open Source License
public static Quaternion readQuaternion(ByteBuf buffer) { final float x = buffer.readFloat(); final float y = buffer.readFloat(); final float z = buffer.readFloat(); final float w = buffer.readFloat(); return new Quaternion(x, y, z, w); }
From source file:org.spout.vanilla.protocol.codec.entity.SteerVehicleCodec.java
License:Open Source License
@Override public SteerVehicleMessage decode(ByteBuf buffer) throws IOException { float sideways = buffer.readFloat(); float forward = buffer.readFloat(); boolean jump = buffer.readByte() != 0; boolean unmount = buffer.readByte() != 0; return new SteerVehicleMessage(sideways, forward, jump, unmount); }
From source file:org.spout.vanilla.protocol.codec.player.PlayerAbilityCodec.java
License:Open Source License
@Override public PlayerAbilityMessage decode(ByteBuf buffer) throws IOException { byte flag = buffer.readByte(); boolean godMode = LogicUtil.getBit(flag, 0x1); boolean isFlying = LogicUtil.getBit(flag, 0x2); boolean canFly = LogicUtil.getBit(flag, 0x4); boolean creativeMode = LogicUtil.getBit(flag, 0x8); float flyingSpeed = buffer.readFloat(); float walkingSpeed = buffer.readFloat(); return new PlayerAbilityMessage(godMode, isFlying, canFly, creativeMode, flyingSpeed, walkingSpeed); }
From source file:org.spout.vanilla.protocol.codec.player.PlayerExperienceCodec.java
License:Open Source License
@Override public PlayerExperienceMessage decode(ByteBuf buffer) throws IOException { float barValue = buffer.readFloat(); short level = buffer.readShort(); short totalExp = buffer.readShort(); return new PlayerExperienceMessage(barValue, level, totalExp); }
From source file:org.spout.vanilla.protocol.codec.player.PlayerHealthCodec.java
License:Open Source License
@Override public PlayerHealthMessage decode(ByteBuf buffer) throws IOException { float health = buffer.readFloat(); short food = buffer.readShort(); float foodSaturation = buffer.readFloat(); return new PlayerHealthMessage(health, food, foodSaturation); }
From source file:org.spout.vanilla.protocol.codec.player.pos.PlayerLookCodec.java
License:Open Source License
@Override public PlayerLookMessage decode(ByteBuf buffer) throws IOException { float yaw = -buffer.readFloat(); float pitch = buffer.readFloat(); boolean onGround = buffer.readByte() == 1; return new PlayerLookMessage(yaw, pitch, onGround); }
From source file:org.spout.vanilla.protocol.codec.player.pos.PlayerPositionLookCodec.java
License:Open Source License
@Override public PlayerPositionLookMessage decode(ByteBuf buffer) throws IOException { double x = buffer.readDouble(); double y = buffer.readDouble(); double stance = buffer.readDouble(); double z = buffer.readDouble(); float yaw = -buffer.readFloat(); float pitch = buffer.readFloat(); boolean onGround = buffer.readByte() == 1; return new PlayerPositionLookMessage(x, y, z, stance, yaw, pitch, onGround, NullRepositionManager.getInstance()); }