use of org.bleachhack.gui.window.Window in project BleachHack by BleachDrinker420.
the class BleachOptionsScreen method addCategory.
private int addCategory(int window, int x, int y, String name, Option<?>... entries) {
getWindow(window).addWidget(new WindowTextWidget("- " + name + " -", true, WindowTextWidget.TextAlign.MIDDLE, x, y, 0xe0e0e0));
y += 20;
for (Option<?> entry : entries) {
// Option
getWindow(0).addWidget(entry.getWidget(x + 10, y - 3, 56, 16));
// Revert button
getWindow(window).addWidget(new WindowButtonWidget(x + 68, y - 3, x + 84, y + 13, "", entry::resetValue).withRenderEvent((w, ms, wx, wy) -> ((WindowButtonWidget) w).text = entry.isDefault() ? "\u00a77\u21c4" : "\u21c4"));
// Name text (at the end because of... reasons)
getWindow(window).addWidget(new WindowTextWidget(new LiteralText(entry.getName()).styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(entry.getTooltip())))), true, x - 107, y, 0xffffff));
y += 17;
}
return y;
}
use of org.bleachhack.gui.window.Window in project BleachHack by BleachDrinker420.
the class BleachTitleScreen method init.
@Override
public void init() {
super.init();
addWindow(new Window(width / 8, height / 8, width - width / 8, height - height / 8 + 2, "BleachHack", new ItemStack(Items.MUSIC_DISC_CAT)));
int w = getWindow(0).x2 - getWindow(0).x1;
int h = getWindow(0).y2 - getWindow(0).y1;
int maxY = MathHelper.clamp(h / 4 + 119, 0, h - 22);
getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, h / 4 + 38, w / 2 + 100, h / 4 + 58, I18n.translate("menu.singleplayer"), () -> client.setScreen(new SelectWorldScreen(client.currentScreen))));
getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, h / 4 + 62, w / 2 + 100, h / 4 + 82, I18n.translate("menu.multiplayer"), () -> client.setScreen(new MultiplayerScreen(client.currentScreen))));
getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, h / 4 + 86, w / 2 + 100, h / 4 + 106, I18n.translate("menu.online"), () -> client.setScreen(new RealmsMainScreen(this))));
getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 124, h / 4 + 86, w / 2 - 104, h / 4 + 106, "MC", () -> {
customTitleScreen = !customTitleScreen;
BleachFileHelper.saveMiscSetting("customTitleScreen", new JsonPrimitive(false));
client.setScreen(new TitleScreen(false));
}));
getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, maxY, w / 2 - 2, maxY + 20, I18n.translate("menu.options"), () -> client.setScreen(new OptionsScreen(client.currentScreen, client.options))));
getWindow(0).addWidget(new WindowButtonWidget(w / 2 + 2, maxY, w / 2 + 100, maxY + 20, I18n.translate("menu.quit"), () -> client.scheduleStop()));
// Main Text
getWindow(0).addWidget(new WindowTextWidget(LiteralText.EMPTY, true, WindowTextWidget.TextAlign.MIDDLE, 3f, w / 2, h / 4 - 25, 0).withRenderEvent((widget, ms, wx, wy) -> {
MutableText bhText = new LiteralText("");
int i = 0;
for (char c : "BleachHack".toCharArray()) {
int fi = i++;
bhText.append(new LiteralText(String.valueOf(c)).styled(s -> s.withColor(TextColor.fromRgb(UI.getRainbowFromSettings(fi)))));
}
((WindowTextWidget) widget).setText(bhText);
}));
// Version Text
getWindow(0).addWidget(new WindowTextWidget(BleachHack.VERSION, true, WindowTextWidget.TextAlign.MIDDLE, 1.5f, w / 2, h / 4 - 6, 0xffc050));
// Splash
getWindow(0).addWidget(new WindowTextWidget(LiteralText.EMPTY, true, WindowTextWidget.TextAlign.MIDDLE, 2f, -20f, w / 2 + 80, h / 4 + 6, 0xffff00).withRenderEvent((widget, ms, wx, wy) -> {
if (splash != null) {
WindowTextWidget windgetText = (WindowTextWidget) widget;
windgetText.setText(new LiteralText(splash));
windgetText.color = (windgetText.color & 0x00ffffff) | ((splashTicks * 17) << 24);
float scale = 1.8F - MathHelper.abs(MathHelper.sin(Util.getMeasuringTimeMs() % 1000L / 1000.0F * 6.2831855F) * 0.1F);
scale = scale * 66.0F / (textRenderer.getWidth(splash) + 32);
windgetText.setScale(scale);
}
}));
// Update Text
JsonObject updateJson = BleachHack.getUpdateJson();
if (updateJson != null && updateJson.has("version") && updateJson.get("version").getAsInt() > BleachHack.INTVERSION) {
getWindow(0).addWidget(new WindowTextWidget("\u00a76\u00a7nUpdate\u00a76", true, 4, h - 12, 0xffffff).withClickEvent((widget, mx, my, wx, wy) -> client.setScreen(new UpdateScreen(client.currentScreen, updateJson))));
}
}
use of org.bleachhack.gui.window.Window in project BleachHack by BleachDrinker420.
the class NotebotScreen method init.
public void init() {
super.init();
files.clear();
BleachFileMang.getDir().resolve("notebot/").toFile().mkdirs();
for (String f : BleachFileMang.getDir().resolve("notebot/").toFile().list()) files.add(f);
int ww = Math.max(width / 2, 360);
int wh = Math.max(height / 2, 200);
addWindow(new Window(width / 2 - ww / 2, height / 2 - wh / 2, width / 2 + ww / 2, height / 2 + wh / 2, "Notebot Gui", new ItemStack(Items.NOTE_BLOCK)));
getWindow(0).addWidget(new WindowButtonWidget(22, 14, 32, 24, "<", () -> page = page <= 0 ? 0 : page - 1));
getWindow(0).addWidget(new WindowButtonWidget(77, 14, 87, 24, ">", () -> page++));
int xEnd = getWindow(0).x2 - getWindow(0).x1;
getWindow(0).addWidget(new WindowButtonWidget(xEnd - 30, 14, xEnd - 3, 24, "Help", () -> Util.getOperatingSystem().open(URI.create("https://www.youtube.com/watch?v=Z6O80jItoAk"))));
}
use of org.bleachhack.gui.window.Window in project BleachHack by BleachDrinker420.
the class ModuleClickGuiScreen method initWindows.
public void initWindows() {
int len = ModuleManager.getModule(ClickGui.class).getSetting(0).asSlider().getValueInt();
int y = 50;
for (ModuleCategory c : ModuleCategory.values()) {
addWindow(new ModuleWindow(ModuleManager.getModulesInCat(c), 30, y, len, StringUtils.capitalize(c.name().toLowerCase()), c.getItem()));
y += 16;
}
for (Window w : getWindows()) {
if (w instanceof ClickGuiWindow) {
((ClickGuiWindow) w).hiding = true;
}
}
}
use of org.bleachhack.gui.window.Window in project BleachHack by BleachDrinker420.
the class ModuleClickGuiScreen method render.
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
BleachFileHelper.SCHEDULE_SAVE_CLICKGUI.set(true);
ClickGui clickGui = ModuleManager.getModule(ClickGui.class);
searchField.visible = clickGui.getSetting(1).asToggle().getState();
if (clickGui.getSetting(1).asToggle().getState()) {
searchField.setSuggestion(searchField.getText().isEmpty() ? "Search here" : "");
Set<Module> seachMods = new HashSet<>();
if (!searchField.getText().isEmpty()) {
for (Module m : ModuleManager.getModules()) {
if (m.getName().toLowerCase(Locale.ENGLISH).contains(searchField.getText().toLowerCase(Locale.ENGLISH).replace(" ", ""))) {
seachMods.add(m);
}
}
}
for (Window w : getWindows()) {
if (w instanceof ModuleWindow) {
((ModuleWindow) w).setSearchedModule(seachMods);
}
}
}
int len = clickGui.getSetting(0).asSlider().getValueInt();
for (Window w : getWindows()) {
if (w instanceof ModuleWindow) {
((ModuleWindow) w).setLen(len);
}
}
super.render(matrices, mouseX, mouseY, delta);
textRenderer.draw(matrices, "BleachHack-" + BleachHack.VERSION + "-" + SharedConstants.getGameVersion().getName(), 3, 3, 0x305090);
textRenderer.draw(matrices, "BleachHack-" + BleachHack.VERSION + "-" + SharedConstants.getGameVersion().getName(), 2, 2, 0x6090d0);
if (clickGui.getSetting(2).asToggle().getState()) {
textRenderer.drawWithShadow(matrices, "Current prefix is: \"" + Command.getPrefix() + "\" (" + Command.getPrefix() + "help)", 2, height - 20, 0x99ff99);
textRenderer.drawWithShadow(matrices, "Use " + Command.getPrefix() + "clickgui to reset the clickgui", 2, height - 10, 0x9999ff);
}
}
Aggregations