Skip to content

Commit

Permalink
fix: 🐛 Fixed backpack to just close gui instead of crashing out of wo…
Browse files Browse the repository at this point in the history
…rld if player happens to press backpack open key at the same time they click the backpack out of slot causing client not having the backpack in slot when server had it and already started opening gui
  • Loading branch information
P3pp3rF1y committed Sep 28, 2024
1 parent 66d779b commit 678ad54
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 678ad54

Please sign in to comment.