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
|
@Subscribe
|
||||||
public void onRender2DHud(Render2DEvent e) {
|
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;
|
if (!(mc.currentScreen instanceof HudEditorScreen) || nullCheck() || OyVey.hudEditorScreen == null) return;
|
||||||
|
|
||||||
float x = getX();
|
float x = getX();
|
||||||
@@ -88,22 +108,6 @@ public abstract class HudModule extends Module {
|
|||||||
OyVey.colorManager.getColor().getRGB(), 1.0f);
|
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() {
|
public int getMouseX() {
|
||||||
return (int) (mc.mouse.getX() / mc.getWindow().getScaleFactor());
|
return (int) (mc.mouse.getX() / mc.getWindow().getScaleFactor());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package me.alpha432.oyvey.features.modules.hud;
|
package me.alpha432.oyvey.features.modules.hud;
|
||||||
|
|
||||||
import me.alpha432.oyvey.event.impl.Render2DEvent;
|
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.modules.client.HudModule;
|
||||||
import me.alpha432.oyvey.features.settings.Setting;
|
import me.alpha432.oyvey.features.settings.Setting;
|
||||||
|
|
||||||
@@ -13,9 +12,8 @@ public class Coordinates extends HudModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Subscribe
|
protected void render(Render2DEvent e) {
|
||||||
public void onRender2D(Render2DEvent e) {
|
super.render(e);
|
||||||
super.onRender2DHud(e);
|
|
||||||
|
|
||||||
if (nullCheck()) return;
|
if (nullCheck()) return;
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ public class Watermark extends HudModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Subscribe
|
protected void render(Render2DEvent e) {
|
||||||
public void onRender2D(Render2DEvent e) {
|
super.render(e);
|
||||||
super.onRender2DHud(e);
|
|
||||||
|
|
||||||
e.getContext().drawTextWithShadow(mc.textRenderer,
|
e.getContext().drawTextWithShadow(mc.textRenderer,
|
||||||
TextUtil.text("{global} %s {} %s", text.getValue(), OyVey.VERSION),
|
TextUtil.text("{global} %s {} %s", text.getValue(), OyVey.VERSION),
|
||||||
|
|||||||
Reference in New Issue
Block a user