use of me.earth.earthhack.api.hud.HudElement in project 3arthh4ck by 3arthqu4ke.
the class HudValuePreset method apply.
@Override
public void apply() {
HudElement module = this.getModule();
Set<Setting<?>> generated = GeneratedSettings.getGenerated(module);
for (Setting<?> setting : generated) {
module.unregister(setting);
}
GeneratedSettings.clear(module);
Map.Entry<String, JsonElement> enabled = null;
for (Map.Entry<String, JsonElement> entry : values.entrySet()) {
if (entry.getKey().equalsIgnoreCase("Enabled")) {
enabled = entry;
continue;
}
setSetting(module, entry);
}
// set enabled last, so all settings are to date when we enter onEnable.
if (enabled != null) {
setSetting(module, enabled);
}
}
use of me.earth.earthhack.api.hud.HudElement in project 3arthh4ck by 3arthqu4ke.
the class HudElementManager method load.
public void load() {
for (HudElement element : getRegistered()) {
Earthhack.getLogger().info(element.getName());
element.load();
}
registered.sort(Comparator.comparing(HudElement::getZ));
}
use of me.earth.earthhack.api.hud.HudElement in project 3arthh4ck by 3arthqu4ke.
the class HudEditorGui method keyTyped.
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
for (HudElement element : Managers.ELEMENTS.getRegistered()) {
if (element.isEnabled()) {
element.guiKeyPressed(typedChar, keyCode);
}
}
panel.keyPressed(typedChar, keyCode);
}
use of me.earth.earthhack.api.hud.HudElement in project 3arthh4ck by 3arthqu4ke.
the class HudEditorGui method mouseReleased.
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
for (HudElement element : Managers.ELEMENTS.getRegistered()) {
if (element.isEnabled()) {
element.guiMouseReleased(mouseX, mouseY, state);
}
}
panel.mouseReleased(mouseX, mouseY, state);
}
use of me.earth.earthhack.api.hud.HudElement in project 3arthh4ck by 3arthqu4ke.
the class HudEditorGui method mouseClicked.
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
List<HudElement> clicked = new ArrayList<>();
boolean hasDragging = false;
for (HudElement element : Managers.ELEMENTS.getRegistered()) {
if (element.isEnabled() && GuiUtil.isHovered(element, mouseX, mouseY)) {
clicked.add(element);
if (element.isDragging())
hasDragging = true;
// element.guiMouseClicked(mouseX, mouseY, mouseButton);
}
}
clicked.sort(Comparator.comparing(HudElement::getZ));
if (!clicked.isEmpty()) {
clicked.get(0).guiMouseClicked(mouseX, mouseY, mouseButton);
} else {
if (!GuiUtil.isHovered(frame, mouseX, mouseY) && !hasDragging) {
selecting = true;
mouseClickedX = mouseX;
mouseClickedY = mouseY;
return;
}
}
frame.mouseClicked(mouseX, mouseY, mouseButton);
}
Aggregations