List of usage examples for io.netty.buffer ByteBuf readShort
public abstract short readShort();
From source file:buildcraft.builders.urbanism.AnchoredBox.java
License:Minecraft Mod Public
@Override public void readData(ByteBuf stream) { box.readData(stream); x1 = stream.readInt(); y1 = stream.readShort(); z1 = stream.readInt(); }
From source file:buildcraft.commander.TileZonePlan.java
License:Minecraft Mod Public
@Override public void readData(ByteBuf stream) { progress = stream.readShort(); }
From source file:buildcraft.core.fluids.TankManager.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) public void readData(ByteBuf data) { for (Tank tank : tanks) { int fluidId = data.readShort(); if (fluidId > 0) { tank.setFluid(new FluidStack(fluidId, data.readInt())); tank.colorRenderCache = data.readInt(); } else {// w w w .j a v a 2 s .c o m tank.setFluid(null); tank.colorRenderCache = 0xFFFFFF; } } }
From source file:buildcraft.core.lib.fluids.TankManager.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) public void readData(ByteBuf data) { for (Tank tank : tanks) { int fluidId = data.readShort(); if (FluidRegistry.getFluid(fluidId) != null) { tank.setFluid(new FluidStack(FluidRegistry.getFluid(fluidId), data.readInt())); tank.colorRenderCache = data.readInt(); } else {//from w w w .j a va 2 s .c o m tank.setFluid(null); tank.colorRenderCache = 0xFFFFFF; } } }
From source file:buildcraft.core.lib.network.command.CommandTargetTile.java
License:Minecraft Mod Public
@Override public ICommandReceiver handle(EntityPlayer player, ByteBuf data, World world) { int posX = data.readInt(); int posY = data.readShort(); int posZ = data.readInt(); if (world.blockExists(posX, posY, posZ)) { TileEntity tile = world.getTileEntity(posX, posY, posZ); if (tile instanceof ICommandReceiver) { return (ICommandReceiver) tile; }/*from w w w . j a v a2 s . c o m*/ } return null; }
From source file:buildcraft.core.lib.network.PacketCoordinates.java
License:Minecraft Mod Public
@Override public void readData(ByteBuf data) { id = data.readByte(); posX = data.readInt(); posY = data.readShort(); posZ = data.readInt(); }
From source file:buildcraft.core.lib.network.PacketTileUpdate.java
License:Minecraft Mod Public
@Override public void readIdentificationData(ByteBuf data) { posX = data.readInt(); posY = data.readShort(); posZ = data.readInt(); }
From source file:buildcraft.core.network.PacketNBT.java
License:Minecraft Mod Public
@Override public void readData(ByteBuf data) { super.readData(data); short length = data.readShort(); byte[] compressed = new byte[length]; data.readBytes(compressed);/*from www . ja va 2 s .c o m*/ try { this.nbttagcompound = CompressedStreamTools.func_152457_a(compressed, NBTSizeTracker.field_152451_a); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:buildcraft.core.network.PacketRPCTile.java
License:Minecraft Mod Public
@Override public void readData(ByteBuf data) { dimId = data.readShort(); x = data.readInt();//w ww. j ava 2 s. c om y = data.readInt(); z = data.readInt(); id = data.readInt(); moreDataToCome = data.readBoolean(); contents = new byte[data.readableBytes()]; data.readBytes(contents); }
From source file:buildcraft.core.network.RPCHandler.java
License:Minecraft Mod Public
private void internalRpcReceive(Object o, RPCMessageInfo info, ByteBuf data) { try {//from ww w. j ava 2 s. c o m short methodIndex = data.readShort(); MethodMapping m = methods[methodIndex]; Class[] formals = m.parameters; Object[] actuals = new Object[formals.length]; int expectedParameters = m.hasInfo ? formals.length - 1 : formals.length; SerializationContext context = new SerializationContext(); for (int i = 0; i < expectedParameters; ++i) { if (int.class.equals(formals[i])) { actuals[i] = data.readInt(); } else if (float.class.equals(formals[i])) { actuals[i] = data.readFloat(); } else if (char.class.equals(formals[i])) { actuals[i] = data.readChar(); } else { actuals[i] = m.mappings[i].read(data, actuals[i], context); } } if (m.hasInfo) { actuals[actuals.length - 1] = info; } m.method.invoke(o, actuals); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } }