List of usage examples for io.netty.buffer ByteBuf readShort
public abstract short readShort();
From source file:org.spout.vanilla.protocol.codec.entity.EntityTileDataCodec.java
License:Open Source License
@Override public EntityTileDataMessage decode(ByteBuf buffer) throws IOException { int x = buffer.readInt(); int y = buffer.readShort(); int z = buffer.readInt(); byte action = buffer.readByte(); CompoundMap data = ByteBufUtils.readCompound(buffer); return new EntityTileDataMessage(x, y, z, action, data, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.entity.spawn.EntityExperienceOrbCodec.java
License:Open Source License
@Override public EntityExperienceOrbMessage decode(ByteBuf buffer) throws IOException { int id = buffer.readInt(); int x = buffer.readInt(); int y = buffer.readInt(); int z = buffer.readInt(); short count = buffer.readShort(); return new EntityExperienceOrbMessage(id, x, y, z, count, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.entity.spawn.EntityMobCodec.java
License:Open Source License
@Override public EntityMobMessage decode(ByteBuf buffer) throws IOException { int id = buffer.readInt(); int type = buffer.readUnsignedByte(); int x = buffer.readInt(); int y = buffer.readInt(); int z = buffer.readInt(); int yaw = buffer.readUnsignedByte(); int pitch = buffer.readUnsignedByte(); int headYaw = buffer.readUnsignedByte(); short velocityZ = buffer.readShort(); short velocityX = buffer.readShort(); short velocityY = buffer.readShort(); List<Parameter<?>> parameters = VanillaByteBufUtils.readParameters(buffer); return new EntityMobMessage(id, type, x, y, z, yaw, pitch, headYaw, velocityZ, velocityX, velocityY, parameters, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.entity.spawn.EntitySpawnObjectCodec.java
License:Open Source License
@Override public EntityObjectMessage decode(ByteBuf buffer) throws IOException { //TODO: There's 2 new bytes. Currently unknown according to wiki.vg 17/12/2012 int entityId = buffer.readInt(); byte type = buffer.readByte(); int x = buffer.readInt(); int y = buffer.readInt(); int z = buffer.readInt(); byte yaw = buffer.readByte(); byte pitch = buffer.readByte(); int throwerId = buffer.readInt(); if (throwerId > 0) { short speedX = buffer.readShort(); short speedY = buffer.readShort(); short speedZ = buffer.readShort(); return new EntityObjectMessage(entityId, type, x, y, z, throwerId, speedX, speedY, speedZ, yaw, pitch, NullRepositionManager.getInstance()); }//from w w w.j a va2s . c o m return new EntityObjectMessage(entityId, type, x, y, z, throwerId, yaw, pitch, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.player.conn.PlayerListCodec.java
License:Open Source License
@Override public PlayerListMessage decode(ByteBuf buffer) throws IOException { String name = VanillaByteBufUtils.readString(buffer); boolean addOrRemove = buffer.readByte() == 1; short ping = buffer.readShort(); return new PlayerListMessage(name, addOrRemove, ping); }
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.scoreboard.ScoreboardTeamCodec.java
License:Open Source License
@Override public ScoreboardTeamMessage decode(ByteBuf buffer) throws IOException { String name = VanillaByteBufUtils.readString(buffer); String displayName, prefix, suffix; boolean friendlyFire = false; String[] players = null;/*from w ww . ja va 2 s. c om*/ byte mode = buffer.readByte(); switch (mode) { case 0: case 2: displayName = VanillaByteBufUtils.readString(buffer); prefix = VanillaByteBufUtils.readString(buffer); suffix = VanillaByteBufUtils.readString(buffer); friendlyFire = buffer.readByte() == 1; players = null; break; case 3: case 4: short count = buffer.readShort(); players = new String[count]; for (int i = 0; i < count; i++) { players[i] = VanillaByteBufUtils.readString(buffer); } default: displayName = prefix = suffix = null; break; } return new ScoreboardTeamMessage(name, mode, displayName, prefix, suffix, friendlyFire, players); }
From source file:org.spout.vanilla.protocol.codec.window.WindowCreativeActionCodec.java
License:Open Source License
@Override public WindowCreativeActionMessage decode(ByteBuf buffer) throws IOException { short slot = buffer.readShort(); ItemStack item = VanillaByteBufUtils.readItemStack(buffer); return new WindowCreativeActionMessage(slot, item); }
From source file:org.spout.vanilla.protocol.codec.window.WindowItemsCodec.java
License:Open Source License
@Override public WindowItemsMessage decode(ByteBuf buffer) throws IOException { byte id = buffer.readByte(); short count = buffer.readShort(); ItemStack[] items = new ItemStack[count]; for (int slot = 0; slot < count; slot++) { items[slot] = VanillaByteBufUtils.readItemStack(buffer); }// w ww. j a v a 2s. co m return new WindowItemsMessage(id, items); }