Fix support of 20-digit numeric seeds
Minetest 64 bit seeds were being listed signed instead of unsigned in some places. E.g. with seed 14105561135541706857, "Copy Seed" used to put -4341182938167844759 in the clipboardmaster
parent
dffe29e2d1
commit
049a030144
|
@ -248,7 +248,7 @@ public class Actions {
|
||||||
public void copySeedToClipboard() {
|
public void copySeedToClipboard() {
|
||||||
ViewerFacade viewerFacade = viewerFacadeSupplier.get();
|
ViewerFacade viewerFacade = viewerFacadeSupplier.get();
|
||||||
if (viewerFacade != null) {
|
if (viewerFacade != null) {
|
||||||
String seed = "" + viewerFacade.getWorldSeed().getLong();
|
String seed = viewerFacade.getWorldSeed().getLongAsString();
|
||||||
StringSelection selection = new StringSelection(seed);
|
StringSelection selection = new StringSelection(seed);
|
||||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ public class Actions {
|
||||||
if (viewerFacade != null) {
|
if (viewerFacade != null) {
|
||||||
BufferedImage image = viewerFacade.createScreenshot();
|
BufferedImage image = viewerFacade.createScreenshot();
|
||||||
String suggestedFilename = "screenshot_" + viewerFacade.getWorldType().getFilenameText() + "_"
|
String suggestedFilename = "screenshot_" + viewerFacade.getWorldType().getFilenameText() + "_"
|
||||||
+ viewerFacade.getWorldSeed().getLong() + ".png";
|
+ viewerFacade.getWorldSeed().getLongAsString() + ".png";
|
||||||
File file = dialogs.askForScreenshotSaveFile(suggestedFilename);
|
File file = dialogs.askForScreenshotSaveFile(suggestedFilename);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
file = appendPNGFileExtensionIfNecessary(file);
|
file = appendPNGFileExtensionIfNecessary(file);
|
||||||
|
|
|
@ -72,9 +72,9 @@ public class SeedHistoryLogger {
|
||||||
private String getSeedString(WorldSeed worldSeed) {
|
private String getSeedString(WorldSeed worldSeed) {
|
||||||
String text = worldSeed.getText();
|
String text = worldSeed.getText();
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
return worldSeed.getLong() + ", " + text;
|
return worldSeed.getLongAsString() + ", " + text;
|
||||||
} else {
|
} else {
|
||||||
return worldSeed.getLong() + "";
|
return worldSeed.getLongAsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,17 +72,23 @@ public class WorldSeed {
|
||||||
private final String text;
|
private final String text;
|
||||||
private final WorldSeedType type;
|
private final WorldSeedType type;
|
||||||
private final String label;
|
private final String label;
|
||||||
|
private final GameEngineType gameEngineType;
|
||||||
|
|
||||||
private WorldSeed(long seed, String text, WorldSeedType type, GameEngineType game_engine_type) {
|
private WorldSeed(long seed, String text, WorldSeedType type, GameEngineType game_engine_type) {
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.gameEngineType = game_engine_type;
|
||||||
this.label = type.getLabel(seed, text, game_engine_type);
|
this.label = type.getLabel(seed, text, game_engine_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong() {
|
public long getLong() {
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLongAsString() {
|
||||||
|
return (gameEngineType == GameEngineType.MINETEST) ? Long.toUnsignedString(seed) : Long.toString(seed);
|
||||||
|
}
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -93,8 +93,8 @@ public enum TestWorldDeclaration {
|
||||||
"testworld",
|
"testworld",
|
||||||
"storage",
|
"storage",
|
||||||
recognisedVersion.getName(),
|
recognisedVersion.getName(),
|
||||||
"" + worldSeed.getLong()).toFile();
|
worldSeed.getLongAsString()).toFile();
|
||||||
this.directoryString = RESOURCE_PREFIX + recognisedVersion.getName() + "/" + worldSeed.getLong() + "/";
|
this.directoryString = RESOURCE_PREFIX + recognisedVersion.getName() + "/" + worldSeed.getLongAsString() + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecognisedVersion getRecognisedVersion() {
|
public RecognisedVersion getRecognisedVersion() {
|
||||||
|
|
Loading…
Reference in New Issue