Skip to content

Commit e9a3894

Browse files
committed
Prevent TMB showing on blacklisted screens.
1 parent 3b5d6d2 commit e9a3894

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/turing/tmb/mixin/client/ScreenMixin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class ScreenMixin {
2626
@Inject(method = "render", at = @At("TAIL"))
2727
public void render(int mouseX, int mouseY, float partialTick, CallbackInfo ci) {
2828
Screen t = (Screen) (Object) this;
29+
if(GuiHelper.screenBlacklist.contains(t.getClass().getCanonicalName())) return;
2930
if (GuiHelper.extraScreens.containsKey(t.getClass().getCanonicalName())) {
3031
IGuiProperties properties = GuiHelper.extraScreens.get(t.getClass().getCanonicalName()).apply(t);
3132
TMBRenderer.renderHeader(mouseX, mouseY, width, height, mc, partialTick, properties);
@@ -38,6 +39,7 @@ public void render(int mouseX, int mouseY, float partialTick, CallbackInfo ci) {
3839
@Inject(method = "tick", at = @At("HEAD"))
3940
public void tick(CallbackInfo ci) {
4041
Screen t = (Screen) (Object) this;
42+
if(GuiHelper.screenBlacklist.contains(t.getClass().getCanonicalName())) return;
4143
if (GuiHelper.extraScreens.containsKey(t.getClass().getCanonicalName())) {
4244
TMBRenderer.onTick();
4345
}
@@ -46,13 +48,16 @@ public void tick(CallbackInfo ci) {
4648
@Inject(method = "mouseClicked", at = @At("HEAD"))
4749
public void mouseClicked(int mouseX, int mouseY, int buttonNum, CallbackInfo ci) {
4850
Screen t = (Screen) (Object) this;
51+
if(GuiHelper.screenBlacklist.contains(t.getClass().getCanonicalName())) return;
4952
if (GuiHelper.extraScreens.containsKey(t.getClass().getCanonicalName())) {
5053
TMBRenderer.mouseClicked(mouseX, mouseY, width, height, mc);
5154
}
5255
}
5356

5457
@Inject(method = "keyPressed", at = @At("TAIL"))
5558
public void checkKeybinds(char eventCharacter, int eventKey, int mx, int my, CallbackInfo ci) {
59+
Screen t = (Screen) (Object) this;
60+
if(GuiHelper.screenBlacklist.contains(t.getClass().getCanonicalName())) return;
5661
if (eventKey == ((IKeybinds) mc.gameSettings).toomanyblocks$getKeyHideTMB().getKeyCode()) {
5762
TMBRenderer.show = !TMBRenderer.show;
5863
}
@@ -61,6 +66,7 @@ public void checkKeybinds(char eventCharacter, int eventKey, int mx, int my, Cal
6166
@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
6267
public void keyPressed(char eventCharacter, int eventKey, int mx, int my, CallbackInfo ci) {
6368
Screen t = (Screen) (Object) this;
69+
if(GuiHelper.screenBlacklist.contains(t.getClass().getCanonicalName())) return;
6470
if (GuiHelper.extraScreens.containsKey(t.getClass().getCanonicalName())) {
6571
TMBRenderer.keyTyped(eventCharacter, eventKey, mx, my);
6672
if (TMBRenderer.search.isFocused) {

0 commit comments

Comments
 (0)