toolbox4minecraft / amidst

Advanced Minecraft Interface and Data/Structure Tracking
GNU General Public License v3.0
2.14k stars 238 forks source link

[Feature request] Show a "open from seed history" button when opening a world #1069

Open evhan751 opened 2 years ago

evhan751 commented 2 years ago

I don't think I'm alone on this one.

In the "file" menu, there could be the "open from seed" option and an additional "open from last seed :___" option. This would save a lot of time, and would be very convenient.

jaszium commented 2 years ago

Hello, I just wanted to inform that I am also in favour of a way to access the Recent Seeds from within the main menu of the Amidst program (or application). I am wondering however, can some additional details regarding the nature of implementing such a feature, be further discussed upon? That is because I can think of 3 Use Cases, when this requested feature will be used.

Note

To clarify some assumptions I had made:

  1. The aim of this feature request is to implement 2 buttons in the File menu within the main menu of the Amidst.
  2. Those buttons could maybe have the name Open From Seed ... and Open Last Seed, where: the former allows the User to access an arbitrary Nth number of seeds (aka all the lines in the history.txt) and the latter allows the User to only access the last or latest seed (aka the last line in the history.txt).
  3. If the history.txt file could be written to by Amidst, reading from it should be possible using the same File Handler.
  4. Once a previously accessed seed had been selected (assuming a User had not changed the option in Settings -> Default World Type to a particular type), a prompt asks that User to select the World Type, then Amidst will open the world (with that particular seed & selected world type) and begin showing the locations of biomes and structures. If the User had changed that setting to a particular world type, then Amidst will open the world without that prompt.
  5. Both of those buttons named above in Note 2. may be clicked multiple times, in succession, or between other events (like the New From Seed, New From Random Seed, and Open Save Game buttons). Therefore, each click of the button must update some internal list (maybe a dynamic Java ArrayList?) of an arbitrary Nth number of seeds, that has to be read from the history.txt. This unfortunately, has to occur every time those buttons are clicked.
  6. There is some level of ambiguity that needs to be discussed & addressed regarding how exactly the Open From Seed ... button works. Is it displaying (as a popup) a new menu with seeds read from history.txt as menu entries (so, CTRL+1 is the latest seed, CTRL+2 is the 2nd latest seed & etc.) OR part of the same main menu as just a (possibly updating its own entries?) sub menu (like how Settings -> Default World Type, and Settings -> Biome Profile were currently implemented?) OR some other method to allow the User to scroll through and find (within Amidst) a specific seed that this User knows does exist in the history.txt? Furthermore, will the sorting order for displaying and selecting those seeds be in a historical (earliest to latest) or a reversed order? (latest to earliest)
  7. There is some level of ambiguity that needs to be discussed & addressed regarding whether duplicate seeds in the list of lines in history.txt are ignored (keeps the latest / earliest one?) OR displayed as separate accessible seeds in whichever method of displaying an arbitrary Nth number of seeds was chosen in Note 6.
  8. There is a high level of ambiguity that critically must be discussed & addressed regarding whether clicking on those buttons (namely Open From Seed ... and Open Last Seed) causes Amidst to append either a Nth-seeds-ago seed or the latest seed to the history.txt. Furthermore, will this be the way duplicate entries become appended into the history.txt OR will it be disallowed?
  9. Will both of these buttons appear disabled (like how the World and Layers menus are when there is no world currently open, showing biomes / structures) if the history.txt doesn't exist and will only the Open From Seed ... button appear disabled if that file does exist but only has 1 line (aka entry / seed / append-attempt of a seed that is from either the New From Seed, New From Random Seed, or Open Save Game buttons), since the only proposed button enabled should be Open Last Seed?
  10. What key binds will be used to quickly click on them with a keyboard? I, in my opinion, prefer _KeyEvent.VKH for the Open From Seed ... button, and _KeyEvent.VKL for the Open Last Seed button; but I don't mind if they differ in the next actual release.

    Cases

    Alright, here are the 3 Use Cases I can think of, when this feature will be used by the community:

    Case 1

    Problem: User just installed Amidst, and created an empty history.txt file in a directory with Amidst having read / write permissions to it. Then they start going through random seeds for a while until skipping past one seed that caught their interest. Their history.txt file is now quite large (10+ MB) and they want a quicker way to go back to the previous seed (without leaving Amidst & going through folders to that directory, then opening the .txt file with associated text editor / reader).

Solution: User selects the File button at the top of the main menu, then the Open Last Seed button.

Note: The workflow should be similar as if they had chosen File -> New From Random Seed; where the seed itself is automatically received.

Case 2

Problem: User has been using Amidst for months, and decides to use it to find a suitable seed for a server they and their friends want to play on. After many discussions, they had narrow down potential seeds for their server to 10. (or x, or Nth, whichever applicable?) This means, they want a way to quickly compare those 10 seeds with each other without taking multiple screenshots, video recordings, having multiple instances of Amidst open (each instance showing each of those 10 seeds at the same time), NOR repeatedly copying & pasting the seed text using File -> New From Seed buttons.

Solution: User selects the File button at the top of the main menu, then the Open From Seed ... button. They see all 10 seeds (and their corresponding text, if available) at once for easy visual comparison with wherever they had discussed and narrowed down the potential seeds for their server. Then, they are able to quickly go through (assuming decisions to be made in Note 6, 7, and 8, shown above were addressed) the list of those 10 seeds and eventually conclude with the single chosen seed for their server.

Note: The workflow (after choosing / selecting the Nth seed) should be similar as if they had chosen File -> New From Random Seed; where the seed itself is automatically received.

Case 3

Problem: User has friends that also have Amidst installed on their machines, for over 2 years. They decide to spend some time making a list of awesome seeds by finding some seeds with X conditions, with Y chances of this events occurring, in Z locations, like finding seeds with:

20+ diamonds in a single blacksmith chest with 2 skeleton spawners near the surface & near each other, and having both a desert & jungle temple visible in the distance (equidistant from the village) from inside that village, OR 5 villages near spawn, each having blacksmith chests & librarian houses surrounded by 4 types of forest biomes on each side (oak, birch, spruce, taiga, or any other combinations of the other types as well), OR ice spike biome next to a badlands biome & a mushroom biome with a warm (coral filled) ocean biome between them at spawn, with that spawn point being on a small island in the centre of the warm ocean with a single tree.

Then, they decide to share their list of awesome randomly generated seeds with each other. However, whenever any of them want to view these seeds quickly, they have no other option except repeatedly copying & pasting the seeds from the history.txt into the text field using the File -> New from seed button.

Solution: User selects the File button at the top of the main menu, then the Open From Seed ... button. They see all 10 seeds (and their corresponding text, if available) at once & is able to quickly go through (assuming decisions to be made in Note 6, 7, and 8, shown above were addressed) the list of those seeds shared by their friends. This presents an opportunity for the creators of YouTube videos claiming "Top X seeds that have Y !!!" (where X is the number of seeds they want to showcase, and Y is the criteria or conditions they chose to select the seeds to showcase), to be able to add a history.txt file to their video description, to easily share their curated list of specific seeds (matching specific criteria / conditions) to all members and users of the Amidst community without them going through the hassle of copying & pasting them into Amidst 1-by-1.

Note: The workflow (after choosing / selecting the Nth seed) should be similar as if they had chosen File -> New From Random Seed; where the seed itself is automatically received.

Lastly

I would like to also inform that I am able to partially figure out what changes need to occur in which files to partially implement this feature request. The main problem I was facing is that there are varying levels of ambiguity that must be discussed & addressed first (particularly the ones in Note 6, 7, and 8, shown above), before the core part of the Open From Seed ... button (reading & displaying seeds in the list of lines in history.txt) can be implemented.

AmidstMenuBuilder.java

PREVIOUS STATE

74  Menus.item(result, actions::openSaveGame,    "Open Save Game ...",    KeyEvent.VK_O, MenuShortcuts.OPEN_SAVE_GAME);
75  result.addSeparator();
76  Menus.item(result, actions::switchProfile,   "Switch Profile ...",    KeyEvent.VK_P, MenuShortcuts.SWITCH_PROFILE);

NEW CHANGES

74  Menus.item(result, actions::openFromSeed,    "Open From Seed ...",    KeyEvent.VK_H, MenuShortcuts.OPEN_FROM_SEED);
75  Menus.item(result, actions::openLastSeed,    "Open Last Seed",        KeyEvent.VK_L, MenuShortcuts.OPEN_LAST_SEED);
76  Menus.item(result, actions::openSaveGame,    "Open Save Game ...",    KeyEvent.VK_O, MenuShortcuts.OPEN_SAVE_GAME);
77  result.addSeparator();
78  Menus.item(result, actions::switchProfile,   "Switch Profile ...",    KeyEvent.VK_P, MenuShortcuts.SWITCH_PROFILE);

Why I prefer _KeyEvent.VKH for the Open From Seed ... button, and _KeyEvent.VKL for the Open Last Seed button:

KeyEvent <enum> is in use: //18 keybinds
In the   Main   Menu: VK_F, VK_W, VK_L, VK_S, VK_H
In the   File   Menu: VK_N, VK_R, VK_F, VK_O, VK_P, VK_X
In the   World  Menu: VK_C, VK_S, VK_H, VK_P, VK_I, VK_O, VK_V, VK_R, VK_M, VK_B, VK_T, VK_X
In the  Layers  Menu: None
In the Settings Menu: VK_R, VK_C
In the   Help   Menu: VK_M, VK_U, VK_L, VK_A
KeyEvent <enum> available:  // 8 keybinds left
    VK_D, VK_E, VK_G, VK_J, VK_K, VK_Q, VK_Y, VK_Z

Because, _KeyEvent.VKH and _KeyEvent.VKL are only applicable after _KeyEvent.VKF had been pressed. Therefore, these buttons will only be clicked if CTRL+F had been pressed first.

MenuShortcuts.java

PREVIOUS STATE

18  OPEN_SAVE_GAME("menu O"),
19  EXPORT_BIOMES("menu X"),
20  SWITCH_PROFILE("menu W"),

NEW CHANGES

18  OPEN_FROM_SEED("menu H"); //unknown keybind; recommend "menu H"
19  OPEN_LAST_SEED("menu L"); //unknown keybind; recommend "menu L"
20  OPEN_SAVE_GAME("menu O"),
21  EXPORT_BIOMES("menu X"),
22  SWITCH_PROFILE("menu W"),

Actions.java

PREVIOUS STATE

74  @CalledOnlyBy(AmidstThread.EDT)
75  public void newFromSeed() {
76      WorldSeed seed = dialogs.askForSeed();
77      if (seed != null) {
78          newFromSeed(seed);
79      }
80  }
81
82  @CalledOnlyBy(AmidstThread.EDT)
83  public void newFromRandom() {
84      biomeExporterDialog.softDispose();
85      newFromSeed(WorldSeed.random());
86  }

NEW CHANGES

74  @CalledOnlyBy(AmidstThread.EDT)
75  public void newFromSeed() {
76      WorldSeed seed = dialogs.askForSeed();
77      if (seed != null) {
78          newFromSeed(seed);
79      }
80  }
81
82  @CalledOnlyBy(AmidstThread.EDT)
83  public void openFromSeed() {
84      WorldSeed seed = WorldSeed.fromUserInput("testA"); //example, need to add replace with actual implementation
85      //show a javax.swing menu of the LAST 16 latest seeds in "history.txt", for each reversed from the last line
86      if (seed != null) {
87          newFromSeed(seed);
88      }
89  }
90  @CalledOnlyBy(AmidstThread.EDT)
91  public void openLastSeed() {
92      WorldSeed seed = WorldSeed.fromUserInput("testA"); //example, need to add replace with actual implementation
93      // the last appended (or highest +ive timestamp) seed in "history.txt", at the last line
94      if (seed != null) {
95          newFromSeed(seed);
96      }
97  }
98
99  @CalledOnlyBy(AmidstThread.EDT)
100 public void newFromRandom() {
101     biomeExporterDialog.softDispose();
102     newFromSeed(WorldSeed.random());
103 }

The code WorldSeed.fromUserInput("testA"); needs to be replaced with a function (or method), such that it will implement the reading of seeds from the history.txt and allow the User to choose / select a seed, which is the class type returned by it. A wordy example might be this: public WorldSeed getSeedFromUser-SelectingFromMenuOfSeeds-FromHistoryFile(){}, although this is essentially 3 or 4 functions (or methods) merged into one. A more realistic name would be public WorldSeed getSeed(){}, which calls public WorldSeed selectFromHistoryMenu(){}, which calls public void updateSeedHistoryEntryList(){}, which calls public ArrayList readSeedHistoryEntry(){} as another example.

Disclaimer

I acknowledge there is a standard approach towards requesting a feature and it is up to the Contributors of Amidst to have a look at the request & decide whether this feature will be implemented, and if so, when. Furthermore, I want to highlight that Issues #119 , #112 , #25 and #12 are where more information from previous discussions regarding the history.txt had occurred. Also, @stefandollase had stated in Issue #12 that:

I see that the restore seed functionality can be useful. However, it will not be a high priority.

on 2016 Jan 8, marked Issues #25 & #112 as Features on 2016 Jan 15 & 2016 Mar 7 respectively, and also stated in Issue #119 that:

Once we get the time, we should develop a consistent idea about how we want to implement #112 file, #25 function & #119 menu so it all works together & with multiple instances of Amidst running different or the same Minecraft profiles at the same time.

on 2016 Mar 9.

Sincerely, a user of "Amidst v4-7, Minecraft 1.7.10, Java 1.8.0_291-b10, Windows 10 v20H2 b19042 r1237", wanting
a way to easily go through recently generated random seeds and begin sharing curated lists of awesome seeds.