Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][compat] iris shaders #173

Merged
merged 2 commits into from
Aug 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EntryListWidget.class)
public abstract class EntryListWidgetMixin {
Expand All @@ -34,21 +36,19 @@ private void renderPanorama(EntryListWidget entryListWidget, MatrixStack matrice
}
}

// Prevent the screen background from drawing
@Redirect(method = "render", at=@At(value = "FIELD",target = "Lnet/minecraft/client/gui/widget/EntryListWidget;renderBackground:Z", opcode = Opcodes.GETFIELD))
private boolean doNotDrawBackground(EntryListWidget entryListWidget){
return !Bedrockify.getInstance().settings.isCubemapBackgroundEnabled() || shouldIgnoreScreen();
@Inject(method = "<init>(Lnet/minecraft/client/MinecraftClient;IIIII)V", at=@At("TAIL"))
lonefelidae16 marked this conversation as resolved.
Show resolved Hide resolved
private void bedrockify$ctor(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight, CallbackInfo ci){
var $this = (EntryListWidget)(Object)this;

// Prevent the screen background from drawing
$this.setRenderBackground(!Bedrockify.getInstance().settings.isCubemapBackgroundEnabled() || shouldIgnoreScreen());
// Prevent top and bottom bars from drawing (Only on pack Screens)
$this.setRenderHorizontalShadows(!(this.client.currentScreen instanceof PackScreen) || !Bedrockify.getInstance().settings.isCubemapBackgroundEnabled());
}

private boolean shouldIgnoreScreen() {
return this.client.currentScreen.getClass().getName().contains(".modmenu.gui.ModsScreen")/* Mod Menu*/ ||
this.client.currentScreen.getClass().getName().contains(".iris.gui.") /* Iris Shaders Compat*/ ||
this.client.currentScreen.getClass().getName().contains(".modmanager.gui."); /* Mod Manager */
}

//Prevent top and bottom bars from drawing (Only on pack Screens)
@Redirect(method = "render", at=@At(value = "FIELD",target = "Lnet/minecraft/client/gui/widget/EntryListWidget;renderHorizontalShadows:Z", opcode = Opcodes.GETFIELD))
private boolean doNotDrawBars(EntryListWidget entryListWidget){
return !(this.client.currentScreen instanceof PackScreen) || !Bedrockify.getInstance().settings.isCubemapBackgroundEnabled();
}
}