Skip to content

Commit

Permalink
🐛 Crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiviacz1337 committed Aug 6, 2024
1 parent db91d45 commit 199534f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<Boolean> 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)
Expand Down

0 comments on commit 199534f

Please sign in to comment.