mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
fixes Wireless Manager (#1336)
This commit is contained in:
1 parent
c8c4c9bb6e
commit
d174867422
3 files changed
+31
-7
No files matched your search
@@ -40,7 +40,7 @@ public class GuiWirelessNetworkManager extends AEBaseGui {
|
||||
this.addButtons();
|
||||
this.renameField.setFocused(false);
|
||||
this.renameField.setVisible(false);
|
||||
this.renameField.setMaxStringLength(96);
|
||||
this.renameField.setMaxStringLength(15);
|
||||
}
|
||||
|
||||
private void addButtons() {
|
||||
|
||||
@@ -59,18 +59,24 @@ public class GuiColorButton extends GuiAeButton {
|
||||
GuiColors.ColorButtonOutline.getColor());
|
||||
|
||||
if (this.drawDisplayString && !Objects.equals(this.displayString, "")) {
|
||||
this.drawCenteredString(
|
||||
mc.fontRenderer,
|
||||
mc.fontRenderer.drawString(
|
||||
this.displayString,
|
||||
this.xPosition + this.width / 2,
|
||||
this.xPosition + this.width / 2 - mc.fontRenderer.getStringWidth(this.displayString) / 2,
|
||||
this.yPosition + (this.height - 8) / 2,
|
||||
Integer.MAX_VALUE);
|
||||
this.getTextColor());
|
||||
}
|
||||
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
private int getTextColor() {
|
||||
final int color = this.color.mediumVariant;
|
||||
return ((0.2126 * ((color >> 16) & 0xFF) + 0.7152 * ((color >> 8) & 0xFF) + 0.0722 * (color & 0xFF)) > 128)
|
||||
? 0xFF000000
|
||||
: 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
public AEColor getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
+20
-2
@@ -116,8 +116,26 @@ public class ContainerWirelessNetworkManager extends AEBaseContainer {
|
||||
private void remove(final byte color) {
|
||||
final NBTTagCompound data = ItemStackNBT.get(this.terminal);
|
||||
final NBTTagCompound keys = data.getCompoundTag("encryptionKeys");
|
||||
keys.removeTag(AEColor.values()[color].name());
|
||||
keys.removeTag(AEColor.values()[color].name() + "Name");
|
||||
|
||||
final String key = AEColor.values()[color].name();
|
||||
final String encryptionKey = keys.getString(key);
|
||||
final String currentEncryptionKey = data.getString("encryptionKey");
|
||||
|
||||
if (encryptionKey.equals(currentEncryptionKey)) {
|
||||
data.removeTag("encryptionKey");
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
final String tempKey = AEColor.values()[i].name();
|
||||
if (tempKey.equals(key)) continue;
|
||||
if (keys.hasKey(tempKey)) {
|
||||
data.setString("encryptionKey", keys.getString(tempKey));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
keys.removeTag(key);
|
||||
keys.removeTag(key + "Name");
|
||||
if (Platform.isServer()) this.checkItem(this.getTarget());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user