Skip to content

Commit

Permalink
Merge pull request #1161 from P3pp3rF1y/1.20.x-dev
Browse files Browse the repository at this point in the history
fix: 🐛 Fixed backpack to just close gui instead of crashing out of wo…
  • Loading branch information
P3pp3rF1y authored Sep 28, 2024
2 parents d242e0b + 678ad54 commit 911c6b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedbackpacks
mod_group_id=sophisticatedbackpacks
mod_version=3.20.9
mod_version=3.20.10
sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.p3pp3rf1y.sophisticatedbackpacks.client.gui;

import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
Expand Down Expand Up @@ -52,4 +54,12 @@ private boolean mouseNotOverBackpack() {
protected String getStorageSettingsTabTooltip() {
return SBPTranslationHelper.INSTANCE.translGui("settings.tooltip");
}

@Override
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
super.render(guiGraphics, mouseX, mouseY, partialTicks);
if (getMenu().getNumberOfStorageInventorySlots() == 0 && Minecraft.getInstance().player != null) {
Minecraft.getInstance().player.closeContainer();
}
}
}

0 comments on commit 911c6b2

Please sign in to comment.