From 199534f9372d2dc757ebfad412d8e1d69dcaba16 Mon Sep 17 00:00:00 2001 From: Kamil <34790800+Tiviacz1337@users.noreply.github.com> Date: Tue, 6 Aug 2024 23:15:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Crash=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../travelersbackpack/mixin/InventoryScreenMixin.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/tiviacz/travelersbackpack/mixin/InventoryScreenMixin.java b/src/main/java/com/tiviacz/travelersbackpack/mixin/InventoryScreenMixin.java index f382202e..44583661 100644 --- a/src/main/java/com/tiviacz/travelersbackpack/mixin/InventoryScreenMixin.java +++ b/src/main/java/com/tiviacz/travelersbackpack/mixin/InventoryScreenMixin.java @@ -35,13 +35,15 @@ public InventoryScreenMixin(PlayerScreenHandler screenHandler, PlayerInventory p @Inject(at = @At(value = "TAIL"), method = "render") public void render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { - if(!TravelersBackpackConfig.getConfig().client.showBackpackIconInInventory || TravelersBackpack.enableAccessories()) return; + if(!TravelersBackpackConfig.getConfig().client.showBackpackIconInInventory) return; PlayerEntity player = MinecraftClient.getInstance().player; if(player == null) return; if(ComponentUtils.isWearingBackpack(player)) { + if(TravelersBackpack.enableAccessories()) return; + context.drawItem(ComponentUtils.getWearingBackpack(player), this.x + 77, this.y + 61 - 18); //guiGraphics.renderItem(AttachmentUtils.getWearingBackpack(player), screen.getGuiLeft() + 59, screen.getGuiTop() + 7); //guiGraphics.renderItem(AttachmentUtils.getWearingBackpack(player), screen.getGuiLeft() - 8 - 9, screen.getGuiTop() + 8 + 18); @@ -62,13 +64,15 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta, Cal @Inject(at = @At(value = "TAIL"), method = "mouseClicked") public void mouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable cir) { - if(!TravelersBackpackConfig.getConfig().client.showBackpackIconInInventory || TravelersBackpack.enableAccessories()) return; + if(!TravelersBackpackConfig.getConfig().client.showBackpackIconInInventory) return; PlayerEntity player = MinecraftClient.getInstance().player; if(player == null) return; if(ComponentUtils.isWearingBackpack(player)) { + if(TravelersBackpack.enableAccessories()) return; + if(mouseX >= this.x + 77 && mouseX < this.x + 77 + 16 && mouseY >= this.y + 61 - 18 && mouseY < this.y + 61 - 18 + 16) { if(InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_LEFT_SHIFT) && button == GLFW.GLFW_MOUSE_BUTTON_1)