Skip to content

Commit 85ad5f8

Browse files
committed
fix: šŸ› Fixed controller-connected double chests crashing during tier upgrades
1 parent 13ff42f commit 85ad5f8

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

ā€Žgradle.propertiesā€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ loader_version_range=[4,)
1515
mod_id=sophisticatedstorage
1616
mod_name=Sophisticated Storage
1717
mod_license=All Rights Reserved
18-
mod_version=1.5.89
18+
mod_version=1.5.90
1919
mod_group_id=net.p3pp3rf1y
2020
mod_authors=P3pp3rF1y, Ridanisaurus
2121
mod_description=Fancy and functional storage containers.
@@ -41,7 +41,7 @@ athena_cf_file_id=5431579
4141
sawmill_cf_file_id=6119477
4242
moonlightlib_cf_file_id=6224057
4343
toms_storage_cf_file_id=7275186
44-
sc_version=[1.21.4-1.4.81,1.21.5)
44+
sc_version=[1.21.4-1.4.82,1.21.5)
4545
sb_version=[1.21.4-3.25.74,1.21.5)
4646

4747
# publish

ā€Žsrc/main/java/net/p3pp3rf1y/sophisticatedstorage/block/ChestBlockEntity.javaā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ && getStorageWrapper().getInventoryHandler().getSlots() > chestBlock.getNumberOf
434434

435435
@Override
436436
public void changeSlots(int newSlots) {
437-
if (hasStorageData()) {
437+
if (hasStorageData() && !isBeingUpgraded()) {
438438
super.changeSlots(newSlots);
439439
}
440440
}

ā€Žsrc/main/java/net/p3pp3rf1y/sophisticatedstorage/item/StorageTierUpgradeItem.javaā€Ž

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,23 @@ private boolean upgradeDoubleChest(BlockPos pos, Level level, BlockState state,
167167

168168
chestBlockEntity.setBeingUpgraded(true);
169169
otherBlockEntity.setBeingUpgraded(true);
170+
StorageBlockEntity newMainBE;
170171
if (chestBlockEntity.isMainChest()) {
171-
StorageBlockEntity newMainBE = upgradeStorageBlock(pos, level, chestBlockEntity, getBlockState(state),
172-
storageBlock.getNumberOfInventorySlots() * 2, storageBlock.getNumberOfUpgradeSlots());
172+
newMainBE = upgradeStorageBlock(pos, level, chestBlockEntity, getBlockState(state), storageBlock.getNumberOfInventorySlots() * 2,
173+
storageBlock.getNumberOfUpgradeSlots());
173174
upgradeStorageBlock(otherPos, level, otherBlockEntity, otherBlockState, storageBlock.getNumberOfInventorySlots(),
174175
storageBlock.getNumberOfUpgradeSlots()).setBeingUpgraded(false);
175176
newMainBE.setBeingUpgraded(false);
176177
} else {
177178
StorageBlockEntity newOtherBE = upgradeStorageBlock(pos, level, chestBlockEntity, getBlockState(state),
178179
storageBlock.getNumberOfInventorySlots(), storageBlock.getNumberOfUpgradeSlots());
179-
upgradeStorageBlock(otherPos, level, otherBlockEntity, otherBlockState, storageBlock.getNumberOfInventorySlots() * 2,
180-
storageBlock.getNumberOfUpgradeSlots()).setBeingUpgraded(false);
180+
newMainBE = upgradeStorageBlock(otherPos, level, otherBlockEntity, otherBlockState, storageBlock.getNumberOfInventorySlots() * 2,
181+
storageBlock.getNumberOfUpgradeSlots());
182+
newMainBE.setBeingUpgraded(false);
181183
newOtherBE.setBeingUpgraded(false);
182184
}
183185
otherBlockState.updateNeighbourShapes(level, otherPos, 3);
186+
newMainBE.changeSlots(newMainBE.getStorageWrapper().getInventoryHandler().getSlots());
184187

185188
return true;
186189
}

0 commit comments

Comments
Ā (0)