List of usage examples for io.netty.buffer ByteBuf writeShort
public abstract ByteBuf writeShort(int value);
From source file:buildcraft.commander.GuiZonePlan.java
License:Minecraft Mod Public
private void uploadMap() { BuildCraftCore.instance.sendToServer(new PacketCommand(getContainer(), "computeMap", new CommandWriter() { public void write(ByteBuf data) { data.writeInt(cx);/*from www. j av a2 s . c om*/ data.writeInt(cz); data.writeShort(getContainer().mapTexture.width); data.writeShort(getContainer().mapTexture.height); data.writeByte(zoomLevel); } })); }
From source file:buildcraft.commander.TileZonePlan.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf stream) { stream.writeShort(progress); }
From source file:buildcraft.core.builders.BuildingItem.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf stream) { origin.writeData(stream);// w ww . j a va 2 s. c om destination.writeData(stream); stream.writeDouble(lifetime); stream.writeShort(stacksToDisplay.size()); for (StackAtPosition s : stacksToDisplay) { s.writeData(stream); } }
From source file:buildcraft.core.builders.TileAbstractBuilder.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf stream) { stream.writeShort(pathLasers.size()); for (LaserData ld : pathLasers) { ld.writeData(stream);/*from w ww.ja v a2 s .c om*/ } }
From source file:buildcraft.core.fluids.TankManager.java
License:Minecraft Mod Public
public void writeData(ByteBuf data) { for (Tank tank : tanks) { FluidStack fluidStack = tank.getFluid(); if (fluidStack != null && fluidStack.getFluid() != null) { data.writeShort(fluidStack.getFluid().getID()); data.writeInt(fluidStack.amount); data.writeInt(fluidStack.getFluid().getColor(fluidStack)); } else {/*w ww .ja v a2s.c o m*/ data.writeShort(-1); } } }
From source file:buildcraft.core.lib.network.command.CommandTargetTile.java
License:Minecraft Mod Public
@Override public void write(ByteBuf data, Object target) { TileEntity tile = (TileEntity) target; data.writeInt(tile.xCoord);/*from w w w . j a v a2s . c o m*/ data.writeShort(tile.yCoord); data.writeInt(tile.zCoord); }
From source file:buildcraft.core.lib.network.PacketCoordinates.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf data) { data.writeByte(id); data.writeInt(posX); data.writeShort(posY); data.writeInt(posZ); }
From source file:buildcraft.core.lib.network.PacketNBT.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf data) { super.writeData(data); try {// w ww .j ava 2s . co m byte[] compressed = CompressedStreamTools.compress(nbttagcompound); if (compressed.length > 65535) { BCLog.logger.error("NBT data is too large (" + compressed.length + " > 65535)! Please report!"); } data.writeShort(compressed.length); data.writeBytes(compressed); } catch (IOException e) { e.printStackTrace(); } }
From source file:buildcraft.core.lib.network.PacketSlotChange.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf data) { super.writeData(data); data.writeShort(slot); NetworkUtils.writeStack(data, stack); }
From source file:buildcraft.core.lib.network.PacketTileState.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf data) { super.writeData(data); ByteBuf tmpState = Unpooled.buffer(); tmpState.writeByte(stateList.size()); for (StateWithId stateWithId : stateList) { tmpState.writeByte(stateWithId.stateId); stateWithId.state.writeData(tmpState); }/* w w w .j av a2s.c om*/ data.writeShort((short) tmpState.readableBytes()); data.writeBytes(tmpState.readBytes(tmpState.readableBytes())); }