Closed ploxxxy closed 11 months ago
gonna have to look at this later bc it prevents the search button from being clicked on for some reason
Hm, that's weird. Can't reproduce this on my end
cir.getReturnValue() != null
seems residual (cuz its boolean value and default returns false) and my original code
@Inject(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(DDI)Z", shift = At.Shift.AFTER), cancellable = true)
works fine.
With these changes,
if(client.inGameHud.getChatHud().getTextStyleAt(mX, mY) != null && isMouseOverSettingsMenu(mX, mY))
cir.setReturnValue(false);
can also be removed. I wonder what IDE you are using? The code formatting looks pretty weird for me.
cir.getReturnValue() != null
seems residual (cuz its boolean value and default returns false) and my original code@Inject(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(DDI)Z", shift = At.Shift.AFTER), cancellable = true)
works fine. With these changes,if(client.inGameHud.getChatHud().getTextStyleAt(mX, mY) != null && isMouseOverSettingsMenu(mX, mY)) cir.setReturnValue(false);
While your suggestions work well for me, they revert some changes made in https://github.com/mrbuilder1961/ChatPatches/commit/e0c330c57cfe8ebd7d9a7c76e5a176989d6adb7c, which are supposed to fix https://github.com/mrbuilder1961/ChatPatches/issues/102. Waiting for @mrbuilder1961 to comment on that.
gonna have to look at this later bc it prevents the search button from being clicked on for some reason
was able to reproduce this: right clicking on the search button.
Fiz-Victor's original code
@Inject(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(DDI)Z", shift = At.Shift.AFTER), cancellable = true)
works well and is more reasonable
and cir.getReturnValue() != null
should be removed? This won't cause a crash
you're absolutely right, i don't see why it would be needed there
ok i will go back and try all this stuff you guys have fixed. not really sure why all these results are so inconsistent though..
the only problem w this is that when the settings menu is open, clicks can trigger click events.
Just put a mixin on onMouseClicked with target ChatHud.onClick and cancel it when Menu is open
doing that now! also, unrelated but could either of you explain what this method is supposed to do? i put a comment but i dont think it describes it right:
@WrapOperation(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;mouseClicked(DDI)Z"))
private boolean disableChatFieldFocus(TextFieldWidget chatField, double mX, double mY, int button, Operation<Boolean> mouseClicked) {
if(!config.hideSearchButton)
return false;
return mouseClicked.call(chatField, mX, mY, button);
}
This should work:
@WrapOperation(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;mouseClicked(DD)Z"))
private boolean fixClickthroughWhenMenuOpen1(ChatHud chatHud, double mX, double mY, Operation<Boolean> mouseClicked) {
if (isMouseOverSettingsMenu(mX, mY) || isMouseOverCopyMenu(mX, mY)) return false;
return mouseClicked.call(chatHud, mX, mY);
}
@WrapOperation(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ChatScreen;getTextStyleAt(DD)Lnet/minecraft/text/Style;"))
private Style fixClickthroughWhenMenuOpen2(ChatScreen screen, double mX, double mY, Operation<Style> getStyle) {
if (isMouseOverSettingsMenu(mX, mY) || isMouseOverCopyMenu(mX, mY)) return null;
return getStyle.call(screen, mX, mY);
}
Also Remove this redundant line: (Patched using the 2 mixins above)
if(client.inGameHud.getChatHud().getTextStyleAt(mX, mY) != null && isMouseOverSettingsMenu(mX, mY))
cir.setReturnValue(false);
@mrbuilder1961 Also I wonder which IDE you are using, cuz the indent looks really weird to me
i checked that and it worked! also, i am using intellij ultimate and i was previously using community edition, with tabs that should be 4spaces in size.