// custom packet public void readPacketData(ByteArrayDataInput data) { try { this.buttonId = data.readByte(); this.probability = (int) data.readByte(); } catch (Exception e) { e.printStackTrace(); } }
@Override public FMLPacket consumePacket(byte[] data) { sentModList = Lists.newArrayList(); ByteArrayDataInput in = ByteStreams.newDataInput(data); int listSize = in.readInt(); for (int i = 0; i < listSize; i++) { sentModList.add(in.readUTF()); } try { compatibilityLevel = in.readByte(); } catch (IllegalStateException e) { FMLLog.fine("No compatibility byte found - the server is too old"); } return this; }
@Override public Object read(ByteArrayDataInput dat) { return dat.readByte(); }