use of mathax.client.systems.proxies.Proxy in project Client by MatHax.
the class MultiplayerScreenMixin method onRender.
@Inject(method = "render", at = @At("TAIL"))
private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
float x = 2;
float y = 2;
String space = " ";
int spaceLength = textRenderer.getWidth(space);
String loggedInAs = "Logged in as";
int loggedInAsLength = textRenderer.getWidth(loggedInAs);
String loggedName = Modules.get().get(NameProtect.class).getName(client.getSession().getUsername());
int loggedNameLength = textRenderer.getWidth(loggedName);
String loggedOpenDeveloper = "[";
int loggedOpenDeveloperLength = textRenderer.getWidth(loggedOpenDeveloper);
String loggedDeveloper = "Developer";
int loggedDeveloperLength = textRenderer.getWidth(loggedDeveloper);
String loggedCloseDeveloper = "]";
// Logged in as
drawStringWithShadow(matrices, textRenderer, loggedInAs, 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, space, loggedInAsLength + 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, loggedName, loggedInAsLength + spaceLength + 2, (int) y, WHITE);
if (Modules.get() != null && !Modules.get().isActive(NameProtect.class) && Utils.isDeveloper(client.getSession().getUuid())) {
drawStringWithShadow(matrices, textRenderer, space, loggedInAsLength + spaceLength + loggedNameLength + 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, loggedOpenDeveloper, loggedInAsLength + spaceLength + loggedNameLength + spaceLength + 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, loggedDeveloper, loggedInAsLength + spaceLength + loggedNameLength + spaceLength + loggedOpenDeveloperLength + 2, (int) y, MatHax.INSTANCE.MATHAX_COLOR_INT);
drawStringWithShadow(matrices, textRenderer, loggedCloseDeveloper, loggedInAsLength + spaceLength + loggedNameLength + spaceLength + loggedOpenDeveloperLength + loggedDeveloperLength + 2, (int) y, GRAY);
}
y += textRenderer.fontHeight + 2;
// Proxy
Proxy proxy = Proxies.get().getEnabled();
String proxyLeft = proxy != null ? "Using proxies" + " " : "Not using a proxies";
String proxyRight = proxy != null ? (proxy.name != null && !proxy.name.isEmpty() ? "(" + proxy.name + ") " : "") + proxy.address + ":" + proxy.port : null;
drawStringWithShadow(matrices, textRenderer, proxyLeft, (int) x, (int) y, GRAY);
if (proxyRight != null)
drawStringWithShadow(matrices, textRenderer, proxyRight, (int) x + textRenderer.getWidth(proxyLeft), (int) y, WHITE);
}
use of mathax.client.systems.proxies.Proxy in project Client by MatHax.
the class ProxiesScreen method initWidgets.
@Override
public void initWidgets() {
// Proxies
WTable table = add(theme.table()).expandX().widget();
for (Proxy proxy : Proxies.get()) {
// Enabled
WCheckbox enabled = table.add(theme.checkbox(proxy.enabled)).widget();
checkboxes.add(enabled);
enabled.action = () -> {
boolean checked = enabled.checked;
Proxies.get().setEnabled(proxy, checked);
for (WCheckbox checkbox : checkboxes) checkbox.checked = false;
enabled.checked = checked;
};
// Name
WLabel name = table.add(theme.label(proxy.name)).widget();
name.color = theme.textColor();
// Type
WLabel type = table.add(theme.label("(" + proxy.type + ")")).widget();
type.color = theme.textSecondaryColor();
// IP + Port
WHorizontalList ipList = table.add(theme.horizontalList()).expandCellX().widget();
ipList.spacing = 0;
ipList.add(theme.label(proxy.address));
ipList.add(theme.label(":")).widget().color = theme.textSecondaryColor();
ipList.add(theme.label(Integer.toString(proxy.port)));
// Edit
WButton edit = table.add(theme.button(GuiRenderer.EDIT)).widget();
edit.action = () -> openEditProxyScreen(proxy);
// Remove
WMinus remove = table.add(theme.minus()).widget();
remove.action = () -> {
Proxies.get().remove(proxy);
reload();
};
table.row();
}
WHorizontalList l = add(theme.horizontalList()).expandX().widget();
// New
WButton newBtn = l.add(theme.button("New")).expandX().widget();
newBtn.action = () -> openEditProxyScreen(null);
// Import
PointerBuffer filters = BufferUtils.createPointerBuffer(1);
ByteBuffer txtFilter = MemoryUtil.memASCII("*.txt");
filters.put(txtFilter);
filters.rewind();
WButton importBtn = l.add(theme.button("Import")).expandX().widget();
importBtn.action = () -> {
String selectedFile = TinyFileDialogs.tinyfd_openFileDialog("Import Proxies", null, filters, null, false);
if (selectedFile != null) {
File file = new File(selectedFile);
mc.setScreen(new ProxiesImportScreen(theme, file));
}
};
}
use of mathax.client.systems.proxies.Proxy in project Client by MatHax.
the class TitleScreenMixin method onRender.
@Inject(method = "render", at = @At("TAIL"))
private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
float y = 2;
float y2 = y + textRenderer.fontHeight + y;
String space = " ";
int spaceLength = textRenderer.getWidth(space);
String loggedInAs = "Logged in as";
int loggedInAsLength = textRenderer.getWidth(loggedInAs);
String loggedName = Modules.get().get(NameProtect.class).getName(client.getSession().getUsername());
int loggedNameLength = textRenderer.getWidth(loggedName);
String loggedOpenDeveloper = "[";
int loggedOpenDeveloperLength = textRenderer.getWidth(loggedOpenDeveloper);
String loggedDeveloper = "Developer";
int loggedDeveloperLength = textRenderer.getWidth(loggedDeveloper);
String loggedCloseDeveloper = "]";
Proxy proxy = Proxies.get().getEnabled();
String proxyUsing = proxy != null ? "Using proxy" + " " : "Not using a proxy";
int proxyUsingLength = textRenderer.getWidth(proxyUsing);
String proxyDetails = proxy != null ? "(" + proxy.name + ") " + proxy.address + ":" + proxy.port : null;
String watermarkName = "MatHax";
int watermarkNameLength = textRenderer.getWidth(watermarkName);
String watermarkVersion = Version.getStylized();
int watermarkVersionLength = textRenderer.getWidth(watermarkVersion);
int watermarkFullLength = watermarkNameLength + spaceLength + watermarkVersionLength;
String authorBy = "By";
int authorByLength = textRenderer.getWidth(authorBy);
String authorName = "Matejko06";
int authorNameLength = textRenderer.getWidth(authorName);
int authorFullLength = authorByLength + spaceLength + authorNameLength;
drawStringWithShadow(matrices, textRenderer, loggedInAs, 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, space, loggedInAsLength + 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, loggedName, loggedInAsLength + spaceLength + 2, (int) y, WHITE);
if (Modules.get() != null && !Modules.get().isActive(NameProtect.class) && Utils.isDeveloper(client.getSession().getUuid())) {
drawStringWithShadow(matrices, textRenderer, space, loggedInAsLength + spaceLength + loggedNameLength + 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, loggedOpenDeveloper, loggedInAsLength + spaceLength + loggedNameLength + spaceLength + 2, (int) y, GRAY);
drawStringWithShadow(matrices, textRenderer, loggedDeveloper, loggedInAsLength + spaceLength + loggedNameLength + spaceLength + loggedOpenDeveloperLength + 2, (int) y, MatHax.INSTANCE.MATHAX_COLOR_INT);
drawStringWithShadow(matrices, textRenderer, loggedCloseDeveloper, loggedInAsLength + spaceLength + loggedNameLength + spaceLength + loggedOpenDeveloperLength + loggedDeveloperLength + 2, (int) y, GRAY);
}
int watermarkPreviousWidth = 0;
drawStringWithShadow(matrices, textRenderer, watermarkName, width - watermarkFullLength - 2, (int) y, MatHax.INSTANCE.MATHAX_COLOR_INT);
watermarkPreviousWidth += watermarkNameLength;
drawStringWithShadow(matrices, textRenderer, space, width - watermarkFullLength + watermarkPreviousWidth - 2, (int) y, WHITE);
watermarkPreviousWidth += spaceLength;
drawStringWithShadow(matrices, textRenderer, watermarkVersion, width - watermarkFullLength + watermarkPreviousWidth - 2, (int) y, GRAY);
int authorPreviousWidth = 0;
drawStringWithShadow(matrices, textRenderer, authorBy, width - authorFullLength - 2, (int) y2, GRAY);
authorPreviousWidth += authorByLength;
drawStringWithShadow(matrices, textRenderer, space, width - authorFullLength + authorPreviousWidth - 2, (int) y2, GRAY);
authorPreviousWidth += spaceLength;
drawStringWithShadow(matrices, textRenderer, authorName, width - authorFullLength + authorPreviousWidth - 2, (int) y2, WHITE);
drawStringWithShadow(matrices, textRenderer, proxyUsing, 2, (int) y2, GRAY);
if (proxyDetails != null)
drawStringWithShadow(matrices, textRenderer, proxyDetails, 2 + proxyUsingLength, (int) y2, WHITE);
}
Aggregations