mirror of
https://github.com/JamesPeters98/ChestsPlusPlus.git
synced 2025-03-13 07:09:07 +01:00
Fixes Chests Closing Bug.
Trying to run Chest animation in unloaded chunks closed the inventory.
This commit is contained in:
parent
1732bac5f2
commit
3a3b0bd780
@ -26,8 +26,14 @@ public class Utils {
|
||||
//Check if all chests should perform open animation.
|
||||
if(Settings.isShouldAnimateAllChests()) {
|
||||
storage.getLocations().forEach(locationInfo -> {
|
||||
if (locationInfo.getLocation() != null) {
|
||||
chestOpenAnimation(storage.getInventory(), locationInfo.getLocation());
|
||||
int chunkX = locationInfo.getLocation().getBlockX() >> 4;
|
||||
int chunkZ = locationInfo.getLocation().getBlockZ() >> 4;
|
||||
Location location = locationInfo.getLocation();
|
||||
if (location != null) {
|
||||
World world = location.getWorld();
|
||||
if (world != null && world.isChunkLoaded(chunkX, chunkZ)) {
|
||||
chestOpenAnimation(storage.getInventory(), locationInfo.getLocation());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user