fix(HudModule): extract rendering method from event subscribed method
This commit is contained in:
@@ -40,6 +40,26 @@ public abstract class HudModule extends Module {
|
||||
|
||||
@Subscribe
|
||||
public void onRender2DHud(Render2DEvent e) {
|
||||
render(e);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMouse(MouseEvent e) {
|
||||
if (!(mc.currentScreen instanceof HudEditorScreen) || nullCheck()) return;
|
||||
if (OyVey.hudEditorScreen == null) return;
|
||||
|
||||
if (e.getAction() == 0) {
|
||||
button = false;
|
||||
dragging = false;
|
||||
OyVey.hudEditorScreen.currentDragging = null;
|
||||
}
|
||||
|
||||
if (e.getAction() == 1 && isHovering()) {
|
||||
button = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void render(Render2DEvent e) {
|
||||
if (!(mc.currentScreen instanceof HudEditorScreen) || nullCheck() || OyVey.hudEditorScreen == null) return;
|
||||
|
||||
float x = getX();
|
||||
@@ -88,22 +108,6 @@ public abstract class HudModule extends Module {
|
||||
OyVey.colorManager.getColor().getRGB(), 1.0f);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMouse(MouseEvent e) {
|
||||
if (!(mc.currentScreen instanceof HudEditorScreen) || nullCheck()) return;
|
||||
if (OyVey.hudEditorScreen == null) return;
|
||||
|
||||
if (e.getAction() == 0) {
|
||||
button = false;
|
||||
dragging = false;
|
||||
OyVey.hudEditorScreen.currentDragging = null;
|
||||
}
|
||||
|
||||
if (e.getAction() == 1 && isHovering()) {
|
||||
button = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMouseX() {
|
||||
return (int) (mc.mouse.getX() / mc.getWindow().getScaleFactor());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package me.alpha432.oyvey.features.modules.hud;
|
||||
|
||||
import me.alpha432.oyvey.event.impl.Render2DEvent;
|
||||
import me.alpha432.oyvey.event.system.Subscribe;
|
||||
import me.alpha432.oyvey.features.modules.client.HudModule;
|
||||
import me.alpha432.oyvey.features.settings.Setting;
|
||||
|
||||
@@ -13,9 +12,8 @@ public class Coordinates extends HudModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Subscribe
|
||||
public void onRender2D(Render2DEvent e) {
|
||||
super.onRender2DHud(e);
|
||||
protected void render(Render2DEvent e) {
|
||||
super.render(e);
|
||||
|
||||
if (nullCheck()) return;
|
||||
|
||||
|
||||
@@ -15,9 +15,8 @@ public class Watermark extends HudModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Subscribe
|
||||
public void onRender2D(Render2DEvent e) {
|
||||
super.onRender2DHud(e);
|
||||
protected void render(Render2DEvent e) {
|
||||
super.render(e);
|
||||
|
||||
e.getContext().drawTextWithShadow(mc.textRenderer,
|
||||
TextUtil.text("{global} %s {} %s", text.getValue(), OyVey.VERSION),
|
||||
|
||||
Reference in New Issue
Block a user