List of usage examples for io.netty.buffer ByteBuf readDouble
public abstract double readDouble();
From source file:de.ellpeck.actuallyadditions.mod.network.PacketParticle.java
@Override public void fromBytes(ByteBuf buf) { this.startX = buf.readDouble(); this.startY = buf.readDouble(); this.startZ = buf.readDouble(); this.endX = buf.readDouble(); this.endY = buf.readDouble(); this.endZ = buf.readDouble(); this.particleAmount = buf.readInt(); this.particleSize = buf.readFloat(); this.color = new float[3]; for (int i = 0; i < this.color.length; i++) { this.color[i] = buf.readFloat(); }/* ww w .j a v a 2 s. com*/ }
From source file:de.sanandrew.mods.betterboat.network.PacketSendBoatPos.java
License:Creative Commons License
@Override public void fromBytes(ByteBuf buf) { this.boatId = buf.readInt(); this.posX = buf.readDouble(); this.posY = buf.readDouble(); this.posZ = buf.readDouble(); this.rotationYaw = buf.readFloat(); this.rotationPitch = buf.readFloat(); }
From source file:gedi.remote.codec.DefaultDecoder.java
License:Apache License
@Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { if (in.readableBytes() < Integer.BYTES) return;// w w w. ja v a 2s. c om in.markReaderIndex(); int size = in.readInt(); if (in.readableBytes() < size) { in.resetReaderIndex(); return; } // everything has arrived, decode char[] classname = new char[in.readInt()]; for (int i = 0; i < classname.length; i++) classname[i] = (char) (in.readByte() & 255); String clsName = String.valueOf(classname); if (clsName.length() == 1) { switch (clsName) { case "A": char[] re = new char[in.readInt()]; for (int i = 0; i < re.length; i++) re[i] = (char) (in.readByte() & 255); out.add(String.valueOf(re)); break; case "B": out.add(in.readByte()); break; case "S": out.add(in.readShort()); break; case "I": out.add(in.readInt()); break; case "L": out.add(in.readLong()); break; case "F": out.add(in.readFloat()); break; case "D": out.add(in.readDouble()); break; } } else { if (!ClassPathCache.getInstance().existsClass(clsName)) { in.resetReaderIndex(); return; } Class<?> cls = Class.forName(clsName); BinarySerializable re = (BinarySerializable) cls.newInstance(); BinaryBlob buff = new BinaryBlob(size - Integer.BYTES - classname.length); in.readBytes(buff.getBuffer()); buff.getBuffer().flip(); re.deserialize(buff); out.add(re); } }
From source file:growthcraft.cellar.common.tileentity.device.BrewKettle.java
License:Open Source License
/** * @param buf - buffer to read from/* www . ja va 2s . co m*/ */ @Override public boolean readFromStream(ByteBuf buf) { super.readFromStream(buf); this.time = buf.readDouble(); this.timeMax = buf.readDouble(); this.grain = buf.readFloat(); heatComponent.readFromStream(buf); return false; }
From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.LightTransmutationAdd.java
License:Open Source License
@Override public void read(ByteBuf buf) { this.in = ByteBufUtils.readItemStack(buf); this.out = ByteBufUtils.readItemStack(buf); this.cost = buf.readDouble(); }
From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.OreTypeAdd.java
License:Open Source License
@Override public void read(ByteBuf buf) { this.oreTypeToAdd = ByteBufUtils.readString(buf); this.weight = buf.readDouble(); }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktDualParticleEvent.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { this.typeOrdinal = buf.readInt(); this.originX = buf.readDouble(); this.originY = buf.readDouble(); this.originZ = buf.readDouble(); this.targetX = buf.readDouble(); this.targetY = buf.readDouble(); this.targetZ = buf.readDouble(); this.additionalData = buf.readDouble(); }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktParticleDataEvent.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { int amt = buf.readInt(); this.data = new double[amt]; for (int i = 0; i < amt; i++) { this.data[i] = buf.readDouble(); }/*w ww . j a v a 2 s. c o m*/ this.xCoord = buf.readDouble(); this.yCoord = buf.readDouble(); this.zCoord = buf.readDouble(); this.effectType = ParticleType.values()[MathHelper.clamp(buf.readInt(), 0, ParticleType.values().length)]; }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktParticleEvent.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { this.typeOrdinal = buf.readInt(); this.xCoord = buf.readDouble(); this.yCoord = buf.readDouble(); this.zCoord = buf.readDouble(); this.additionalData = buf.readDouble(); }
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktShootEntity.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { this.entityId = buf.readInt(); this.motionVector = new Vector3(buf.readDouble(), buf.readDouble(), buf.readDouble()); this.hasEffect = buf.readBoolean(); if (this.hasEffect) { this.effectLength = buf.readDouble(); }/*from w w w. j a va 2 s. com*/ }