use of me.desht.pneumaticcraft.api.client.pneumaticHelmet.IUpgradeRenderHandler in project pnc-repressurized by TeamPneumatic.
the class GuiKeybindCheckBox method onMouseClicked.
@Override
public void onMouseClicked(int mouseX, int mouseY, int button) {
if (button == 0) {
super.onMouseClicked(mouseX, mouseY, button);
GuiKeybindCheckBox trackedBox = trackedCheckboxes.get(keyBindingName);
if (trackedBox != this) {
trackedBox.onMouseClicked(mouseX, mouseY, button);
} else {
HelmetWidgetDefaults.INSTANCE.setKey(keyBindingName, checked);
try {
HelmetWidgetDefaults.INSTANCE.writeToFile();
} catch (IOException e) {
e.printStackTrace();
}
for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
IUpgradeRenderHandler upgradeRenderHandler = UpgradeRenderHandlerList.instance().upgradeRenderers.get(i);
if (("pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName()).equals(keyBindingName)) {
NetworkHandler.sendToServer(new PacketToggleHelmetFeature((byte) i, GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked && checked));
}
}
if (keyBindingName.equals("pneumaticHelmet.upgrade.coreComponents")) {
for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
NetworkHandler.sendToServer(new PacketToggleHelmetFeature((byte) i, checked && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked));
}
}
}
} else {
isAwaitingKey = !isAwaitingKey;
if (isAwaitingKey) {
oldCheckboxText = text;
text = "gui.setKeybind";
} else {
text = oldCheckboxText;
}
}
}
Aggregations