Skip to content

Commit

Permalink
fix: šŸ› Fixed storage gui to close if something has messed with numberā€¦
Browse files Browse the repository at this point in the history
ā€¦ of slots in the storage like in case of double chest when creeper explodes half of it
  • Loading branch information
P3pp3rF1y committed Dec 29, 2024
1 parent e678243 commit 5973490
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
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=sophisticatedcore
mod_group_id=sophisticatedcore
mod_version=1.0.1
mod_version=1.0.2
sonar_project_key=sophisticatedcore:SophisticatedCore
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedCore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,8 @@ public boolean mayPickup(Player playerIn) {
return addSlot(slot);
}

public void closeScreenIfSomethingMessedWithStorageItemStack() {
if (!isClientSide() && storageItemHasChanged()) {
player.closeContainer();
}
public boolean hasSomethingMessedWithStorage() {
return !isClientSide() && (storageItemHasChanged() || realInventorySlots.size() != storageWrapper.getInventoryHandler().getSlots() + NUMBER_OF_PLAYER_SLOTS);
}

protected boolean isClientSide() {
Expand Down Expand Up @@ -1459,7 +1457,10 @@ public void setItem(int slotId, int pStateId, ItemStack pStack) {

@Override
public void broadcastChanges() {
closeScreenIfSomethingMessedWithStorageItemStack();
if (hasSomethingMessedWithStorage()) {
player.closeContainer();
return;
}

synchronizeCarriedToRemote();
broadcastChangesIn(lastUpgradeSlots, remoteUpgradeSlots, upgradeSlots, getFirstUpgradeSlot());
Expand Down

0 comments on commit 5973490

Please sign in to comment.