Skip to content

Commit

Permalink
Sort drawers insertion from closest to furthest to the drawer control…
Browse files Browse the repository at this point in the history
…ler, closes #103
  • Loading branch information
Buuz135 committed Jan 7, 2024
1 parent 5e0fd58 commit f61eef4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# VERSION 1.2.8
* Sort drawers insertion from closest to furthest to the drawer controller, closes #103

# VERSION 1.2.7
* Fixed cascading loading issues, closes #243

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'

group = 'com.buuz135'
version = '1.20.1-1.2.7'
version = '1.20.1-1.2.8'

java {
archivesBaseName = 'functionalstorage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraftforge.items.IItemHandler;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class ConnectedDrawers implements INBTSerializable<CompoundTag> {
Expand Down Expand Up @@ -59,6 +60,7 @@ public void rebuild() {
}
var area = new AABB(controllerTile.getBlockPos()).inflate(FunctionalStorageConfig.DRAWER_CONTROLLER_LINKING_RANGE + extraRange);
this.connectedDrawers.removeIf(aLong -> !area.contains(Vec3.atCenterOf(BlockPos.of(aLong))));
this.connectedDrawers.sort(Comparator.comparingDouble(value -> BlockPos.of(value).distSqr(controllerTile.getBlockPos())));
for (Long connectedDrawer : this.connectedDrawers) {
BlockPos pos = BlockPos.of(connectedDrawer);
BlockEntity entity = level.getBlockEntity(pos);
Expand Down

0 comments on commit f61eef4

Please sign in to comment.