@Override public void refreshData(ContainerManager container, ComponentMenu newData) { ComponentMenuRedstoneOutput newDataOutput = (ComponentMenuRedstoneOutput) newData; if (textBox.getNumber() != newDataOutput.textBox.getNumber()) { textBox.setNumber(newDataOutput.textBox.getNumber()); DataWriter dw = getWriterForClientComponentPacket(container); dw.writeBoolean(true); // header dw.writeData(textBox.getNumber(), DataBitHelper.MENU_REDSTONE_ANALOG); PacketHandler.sendDataToListeningClients(container, dw); } if (radioButtons.getSelectedOption() != newDataOutput.radioButtons.getSelectedOption()) { radioButtons.setSelectedOption(newDataOutput.radioButtons.getSelectedOption()); DataWriter dw = getWriterForClientComponentPacket(container); dw.writeBoolean(false); // header dw.writeData(radioButtons.getSelectedOption(), DataBitHelper.MENU_REDSTONE_OUTPUT_TYPE); PacketHandler.sendDataToListeningClients(container, dw); } }
@Override public void refreshData(ContainerManager container, ComponentMenu newData) { ComponentMenuContainerTypes newDataTypes = (ComponentMenuContainerTypes) newData; for (int i = 0; i < checked.length; i++) { if (newDataTypes.checked[i] != checked[i]) { checked[i] = newDataTypes.checked[i]; DataWriter dw = getWriterForClientComponentPacket(container); dw.writeData(i, DataBitHelper.CONTAINER_TYPE); dw.writeBoolean(checked[i]); PacketHandler.sendDataToListeningClients(container, dw); } } }