fix(hud): unify enabled/dragging semantics and rendering pipeline
- HudElement: drop the parallel 'visible' field and the isEnabled/ setEnabled overrides. The dual flag was getting out of sync with Module.enabled, so HUD listeners never registered on the event bus and onTick/onPacket never fired (PlayerListHud, KeyBindsHud and PotionEffectsHud rendered as empty panels). The base Module.enabled is now the single source of truth. - HudElement: rename hudWidth/hudHeight to width/height and let Lombok generate getters/setters; expose 'dragging' via @Setter so callers don't need a hand-written setDragging. - ChatScreenPatch: the chat-screen drag hook was reading/writing isEnabled/setEnabled when it really meant dragging/setDragging, which is why opening the chat would silently disable any HUD you had on screen. Switch to isDragging/setDragging. - Add cloud_assets/ (panel.png, ptr.png, lie.wav, truth.wav) needed by LieDetector. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@ package shit.zen.hud;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.Generated;
|
||||
import shit.zen.event.impl.GlRenderEvent;
|
||||
import shit.zen.event.impl.Render2DEvent;
|
||||
import shit.zen.modules.Category;
|
||||
@@ -15,15 +14,16 @@ extends Module {
|
||||
protected float x;
|
||||
@Getter @Setter
|
||||
protected float y;
|
||||
protected float hudWidth;
|
||||
protected float hudHeight;
|
||||
@Getter
|
||||
@Getter @Setter
|
||||
protected float width;
|
||||
@Getter @Setter
|
||||
protected float height;
|
||||
@Getter @Setter
|
||||
private boolean dragging = false;
|
||||
@Getter @Setter
|
||||
private float dragOffsetX;
|
||||
@Getter @Setter
|
||||
private float dragOffsetY;
|
||||
protected boolean visible;
|
||||
|
||||
public HudElement(String string) {
|
||||
super(string, Category.RENDER);
|
||||
@@ -51,47 +51,10 @@ extends Module {
|
||||
}
|
||||
|
||||
public boolean isHovered(int mouseX, int mouseY) {
|
||||
return RenderUtil.isHovered(this.x, this.y, this.hudWidth, this.hudHeight, mouseX, mouseY);
|
||||
return RenderUtil.isHovered(this.x, this.y, this.width, this.height, mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void stopDragging() {
|
||||
this.dragging = false;
|
||||
}
|
||||
|
||||
@Generated
|
||||
public float getWidth() {
|
||||
return this.hudWidth;
|
||||
}
|
||||
|
||||
@Generated
|
||||
public float getHeight() {
|
||||
return this.hudHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Generated
|
||||
public boolean isEnabled() {
|
||||
return this.visible;
|
||||
}
|
||||
|
||||
@Generated
|
||||
public void setWidth(float width) {
|
||||
this.hudWidth = width;
|
||||
}
|
||||
|
||||
@Generated
|
||||
public void setHeight(float height) {
|
||||
this.hudHeight = height;
|
||||
}
|
||||
|
||||
@Generated
|
||||
protected void setDragging(boolean dragging) {
|
||||
this.dragging = dragging;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Generated
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.visible = enabled;
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@ extends ClientBase {
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
|
||||
if (enabled) {
|
||||
ZenClient.getInstance().getEventBus().register(this);
|
||||
this.onEnable();
|
||||
@@ -93,4 +94,4 @@ extends ClientBase {
|
||||
return this.keyCode;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,11 @@ public class ChatScreenPatch {
|
||||
public static void onRender(ChatScreen screen, GuiGraphics graphics, int mouseX, int mouseY, float partialTick, CallbackInfo callbackInfo) {
|
||||
try {
|
||||
for (HudElement element : ZenClient.getInstance().getHudManager().getHudElements().stream().filter(Module::isEnabled).toList()) {
|
||||
if (!element.isEnabled()) continue;
|
||||
if (!element.isDragging()) continue;
|
||||
element.mouseDragged(mouseX, mouseY);
|
||||
boolean leftDown = GLFW.glfwGetMouseButton(ClientBase.mc.getWindow().getWindow(), 0) == 1;
|
||||
if (!leftDown) {
|
||||
element.setEnabled(false);
|
||||
element.setDragging(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
Reference in New Issue
Block a user