List of usage examples for io.netty.buffer ByteBuf readFloat
public abstract float readFloat();
From source file:growthcraft.milk.common.tileentity.TileEntityCheeseVat.java
License:Open Source License
@EventHandler(type = EventHandler.EventType.NETWORK_READ) public boolean readFromStream_CheeseVat(ByteBuf stream) throws IOException { this.progressMax = stream.readInt(); this.progress = stream.readFloat(); heatComponent.readFromStream(stream); String name = "idle"; try {//from w w w .j a v a 2s .c o m name = StreamUtils.readStringASCII(stream); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } this.vatState = CheeseVatState.getStateSafe(name); return false; }
From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.InfusionRecipeAdd.java
License:Open Source License
@Override public void read(ByteBuf buf) { this.in = ByteBufUtils.readItemStack(buf); this.out = ByteBufUtils.readItemStack(buf); this.consumeAll = buf.readBoolean(); this.consumeChance = buf.readFloat(); this.craftingTickTime = buf.readInt(); }
From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.WellRecipeAdd.java
License:Open Source License
@Override public void read(ByteBuf buf) { this.inStack = ByteBufUtils.readItemStack(buf); this.fluidOut = FluidRegistry.getFluid(ByteBufUtils.readString(buf)); this.productionMultiplier = buf.readFloat(); this.shatterMultiplier = buf.readFloat(); this.colorHex = buf.readInt(); }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktLightningEffect.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { from = Vector3.fromBytes(buf); to = Vector3.fromBytes(buf);/*from w w w.j a va 2s. com*/ if (buf.readBoolean()) { float[] colorComponents = new float[4]; for (int i = 0; i < colorComponents.length; i++) { colorComponents[i] = buf.readFloat(); } colorOverlay = new Color(colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]); } }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktSyncCharge.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { this.charge = buf.readFloat(); }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktSyncStepAssist.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { this.stepHeight = buf.readFloat(); }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktUpdateReach.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { this.apply = buf.readBoolean(); this.modifier = buf.readFloat(); }
From source file:hivemall.mix.MixMessageDecoder.java
License:Open Source License
@Override protected MixMessage decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { ByteBuf frame = (ByteBuf) super.decode(ctx, in); if (frame == null) { return null; }/*from w w w . ja v a 2 s. c om*/ byte b = frame.readByte(); MixEventName event = MixEventName.resolve(b); Object feature = decodeObject(frame); float weight = frame.readFloat(); float covariance = frame.readFloat(); short clock = frame.readShort(); int deltaUpdates = frame.readInt(); boolean cancelRequest = frame.readBoolean(); String groupID = readString(frame); MixMessage msg = new MixMessage(event, feature, weight, covariance, clock, deltaUpdates, cancelRequest); msg.setGroupID(groupID); return msg; }
From source file:io.crate.protocols.postgres.types.RealType.java
License:Apache License
@Override public Object readBinaryValue(ByteBuf buffer, int valueLength) { assert valueLength == TYPE_LEN : "length should be " + TYPE_LEN + " because float is int32. Actual length: " + valueLength;//from ww w . j a v a 2 s. c o m return buffer.readFloat(); }
From source file:io.github.stormcloud_dev.stormcloud.seralization.RORObjectDecoder.java
License:Apache License
private Object readNextObject(ByteBuf buf) { if (buf.readableBytes() < 12) { return null; }//from w ww.ja va 2 s .co m byte[] header = new byte[8]; buf.readBytes(8).readBytes(header); //Handshake header if (Arrays.equals(header, new byte[] { -66, -70, -2, -54, 11, -80, -83, -34 })) { if (buf.readableBytes() >= 8) { buf.readBytes(8); //We read the rest of the handshake packet //Contains the length (inclusive the header) and 2 unknown numbers return new HandshakeFrame(); } else { return null; } } int length = buf.readByte(); buf.readBytes(3); byte id = buf.readByte(); if (id != 16) { int readerIndex = buf.readerIndex(), writerIndex = buf.writerIndex(); byte[] bytes = new byte[buf.readableBytes()]; buf.readBytes(buf.readableBytes()).readBytes(bytes); buf.setIndex(readerIndex, writerIndex); // Print packets - debugging purposes //System.out.println("ID: " + id + " - " + Arrays.toString(bytes)); } switch (id) { case 0: //if (length < 39) return null; return new PositionInfoServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte()); case 1: return new SetReadyServerBoundFrame(buf.readByte()); case 2: return new SetPlayerServerBoundFrame(buf.readDouble(), buf.readDouble(), readString(buf)); case 3: return new AddPlayerServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readInt(), buf.readInt(), readString(buf)); case 4: return new ChatPlayerServerBoundFrame(readString(buf)); case 5: return new UpdatePlayerServerBoundFrame(buf.readInt(), buf.readDouble(), buf.readDouble(), readString(buf)); case 6: return new KeyPlayerServerBoundFrame(buf.readShort(), buf.readShort(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readShort(), buf.readByte()); case 7: return new HealPlayerServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readDouble()); case 8: return new NPCHPServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readShort(), buf.readShort(), buf.readShort()); case 9: return new MDeadServerBoundFrame(); case 10: return new NPCTargetServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readInt(), buf.readShort(), buf.readByte()); case 11: return new KeyMonsterServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readShort()); case 12: return new CreateObjectServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble()); case 13: return new CreateLevelObjectServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readInt()); case 14: return new SyncAlarmServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readInt()); case 15: return new SpawnClassicServerBoundFrame(buf.readShort(), buf.readDouble(), buf.readDouble(), buf.readByte(), buf.readShort(), buf.readShort(), buf.readShort()); case 16: return new LagPlayerServerBoundFrame(readString(buf)); case 17: return new DisPlayerServerBoundFrame(); case 18: return new TransportServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readByte()); case 19: return new ActivateObjectServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readShort(), buf.readShort(), buf.readByte(), buf.readByte()); case 20: return new SpawnItemServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readInt()); case 21: return new SyncVarServerBoundFrame(buf.readDouble()); case 22: return new SpawnBossServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readByte(), buf.readDouble()); case 23: return new SpawnClassicBossServerBoundFrame(buf.readDouble(), buf.readDouble(), buf.readInt(), buf.readInt(), buf.readDouble(), buf.readByte(), buf.readShort(), buf.readShort(), buf.readShort(), buf.readDouble()); case 24: return new LevelUpServerBoundFrame(); case 25: return new ItemPickupServerBoundFrame(buf.readInt(), buf.readByte()); case 26: return new ChatSystemServerBoundFrame(buf.readByte(), readString(buf)); case 27: return new TestServerBoundFrame(); case 28: return new ItemSwapServerBoundFrame(); case 29: return readItemProcFrame(buf); case 30: return new ShrineProcServerBoundFrame(buf.readByte()); case 31: return new SpawnDroneServerBoundFrame(buf.readShort(), buf.readShort(), buf.readShort(), buf.readShort(), buf.readShort(), buf.readShort(), buf.readShort()); case 32: return new SetPriceServerBoundFrame(buf.readShort(), buf.readShort()); case 33: return new CreateChestServerBoundFrame(); case 34: return new UpdateBuffsServerBoundFrame(buf.readDouble(), buf.readShort(), buf.readShort()); case 35: return new SpawnImpmServerboundFrame(buf.readShort(), buf.readShort(), buf.readShort(), buf.readByte(), buf.readByte()); case 36: return new UpdateChest4ServerBoundFrame(buf.readShort()); case 37: return new EliteTeleportServerBoundFrame(buf.readShort(), buf.readShort()); case 38: return new UpdateHpServerBoundFrame(buf.readShort()); case 39: return new UpdateDiffServerBoundFrame(buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte(), buf.readByte()); case 40: return new SpawnGhostServerBoundFrame(buf.readShort(), buf.readShort(), buf.readFloat(), buf.readFloat()); case 41: return new StopTimeServerBoundFrame(buf.readShort()); case 42: return new LandLizardServerBoundFrame(buf.readShort(), buf.readShort()); case 43: return new DestroyObjectServerBoundFrame(); case 44: return new CreateSlimeServerBoundFrame(buf.readShort(), buf.readShort(), buf.readFloat(), buf.readShort(), buf.readShort(), buf.readShort(), buf.readByte(), buf.readShort(), buf.readDouble()); case 45: return new CrewChoiceServerBoundFrame(buf.readShort()); case 46: return new CreateItemServerBoundFrame(buf.readShort(), buf.readShort(), buf.readShort()); case 47: return new ActivateSwitchServerBoundFrame(buf.readShort(), buf.readShort()); default: return null; } }