diff --git a/src/main/java/net/silentclient/client/mixin/mixins/GuiContainerMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/GuiContainerMixin.java index d905545..946298e 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/GuiContainerMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/GuiContainerMixin.java @@ -6,14 +6,18 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.cosmetics.StaticResourceLocation; +import net.silentclient.client.gui.hud.Watermark; import net.silentclient.client.mixin.ducks.EntityRendererExt; import net.silentclient.client.mods.render.InventoryBlurMod; 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; +import java.awt.*; + @Mixin(GuiContainer.class) public abstract class GuiContainerMixin extends GuiScreen { @@ -22,7 +26,7 @@ public abstract class GuiContainerMixin extends GuiScreen { @Shadow private int dragSplittingRemnant; @Inject(method = "updateDragSplitting", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;"), cancellable = true) - private void patcher$fixRemnants(CallbackInfo ci) { + private void silent$fixRemnants(CallbackInfo ci) { if (this.dragSplittingButton == 2) { this.dragSplittingRemnant = mc.thePlayer.inventory.getItemStack().getMaxStackSize(); ci.cancel(); @@ -56,7 +60,21 @@ public abstract class GuiContainerMixin extends GuiScreen { protected abstract boolean checkHotbarKeys(int keyCode); @Inject(method = "mouseClicked", at = @At("TAIL")) - private void patcher$checkHotbarClicks(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) { + private void silent$checkHotbarClicks(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) { checkHotbarKeys(mouseButton - 100); } + + @Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawDefaultBackground()V")) + public void customBackground(GuiContainer instance) { + if(!Client.getInstance().getModInstances().getModByClass(InventoryBlurMod.class).isEnabled() || Client.getInstance().getSettingsManager().getSettingByClass(InventoryBlurMod.class, "Dark Background").getValBoolean()) { + this.drawDefaultBackground(); + } else { + this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 0).getRGB(), new Color(0, 0, 0, 0).getRGB()); + } + } + + @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGuiContainerBackgroundLayer(FII)V")) + public void watermark(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + new Watermark().render(); + } }