Skip to content

Commit

Permalink
🐛 Fix drive loading bug!
Browse files Browse the repository at this point in the history
  • Loading branch information
XyperCode committed Jun 21, 2024
1 parent 8cd0043 commit f866b8f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ultreon Devices Mod [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Ultreon/devices-mod/tree/1.19.3-development.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Ultreon/devices-mod/tree/1.19.3-development)
**Language:** Java
**Minecraft Version:** `1.19.3`, `1.20.1`
**Minecraft Version:** `1.19.3`, `1.20.1`, `1.20.4`
**Mod Loader:** [Forge](https://files.minecraftforge.net/), [NeoForge](https://neoforged.net/), [Fabric](https://fabricmc.net/)
**Download:** [[CurseForge]](https://curseforge.com/minecraft/mc-mods/devices-mod), [[CurseForge Legacy]](https://legacy.curseforge.com/minecraft/mc-mods/devices-mod), [[Modrinth]](https://modrinth.com/mod/devices-mod)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,18 @@ public void handleLoad() {

assert tag != null;
ListTag driveList = tag.getList("available_drives", Tag.TAG_COMPOUND);
Drive[] drives = new Drive[driveList.size() + 1];
drives[0] = currentDrive = MineOS.getOpened().getMainDrive();
List<Drive> drives = new ArrayList<>(driveList.size() + 1);
Drive mainDrive = MineOS.getOpened().getMainDrive();
if (mainDrive != null) {
currentDrive = mainDrive;
drives.add(mainDrive);
}

for (int i = 0; i < driveList.size(); i++) {
CompoundTag driveTag = driveList.getCompound(i);
drives[i + 1] = new Drive(driveTag);
drives.add(new Drive(driveTag));
}
comboBoxDrive.setItems(drives);
comboBoxDrive.setItems(drives.toArray(Drive[]::new));

Folder folder = currentDrive.getFolder(initialFolder);
if (folder != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ public Drive getMainDrive() {

@Deprecated
public void setMainDrive(Drive mainDrive) {
if (this.mainDrive == null) {
this.mainDrive = mainDrive;
}
bios.setMainDrive(mainDrive);
}

/**
Expand Down

0 comments on commit f866b8f

Please sign in to comment.