fixes Wireless Manager (#1336)

This commit is contained in:
lc-1337 authored and GitHub committed 2026-05-31 19:42:52 +02:00
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;
}
@@ -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());
}