Skip to content

Commit

Permalink
Merge pull request #172 from Querz/1.17
Browse files Browse the repository at this point in the history
1.14 release
  • Loading branch information
Querz authored Feb 26, 2021
2 parents 15ade35 + b71b0c9 commit aecf5fd
Show file tree
Hide file tree
Showing 192 changed files with 10,499 additions and 4,104 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ test113/
*.patch
import_test/
*.log
deploy/
/*_rsa
export/
!src/test/resources/import/source/*.mca
!src/test/resources/import/target/*.mca
!src/test/resources/anvil*/*.mca
!src/test/resources/anvil*/*.mca
7za.exe
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
dist: trusty
language: java
jdk:
- oraclejdk8
addons:
ssh_known_hosts: deploy.querz.net

before_install:
# update apt-get
- sudo apt-get update

# inno setup
- sudo apt-get install -y -q wine unzip
- wine --version
- sudo sh travis/inno/innoinstall.sh

# download 7zip
- sudo sh travis/inno/7zipdownload.sh

install:
# disable default travis behavior 'gradle assemble'
- ./gradlew -v

script:
# gradle build
- sudo ./gradlew clean build shadowJar createExe installer --stacktrace --warning-mode all

# run inno setup
- sudo sh travis/inno/iscc.sh build/inno/inno.iss

after-success:
# decrypt deployment key
- openssl aes-256-cbc -K $encrypted_db2095f63ba3_key -iv $encrypted_db2095f63ba3_iv -in travis/deploy/deploy_rsa.enc -out travis/deploy/deploy_rsa -d
- eval "$(ssh-agent -s)"
- chmod 600 travis/deploy/deploy_rsa
- ssh-add travis/deploy/deploy_rsa

# send output to deployment server
- ssh [email protected] "mkdir -p ~/mcaselector/$TRAVIS_BUILD_ID/"
- scp -r build/inno/Output/* "[email protected]:~/mcaselector/$TRAVIS_BUILD_ID/"
- scp -r build/libs/*.jar "[email protected]:~/mcaselector/$TRAVIS_BUILD_ID/"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 - 2020 Querz
Copyright (c) 2018 - 2021 Querz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
149 changes: 97 additions & 52 deletions README.md

Large diffs are not rendered by default.

59 changes: 55 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.github.eriwen:gradle-css-plugin:9fe88d7126'
classpath 'com.github.jengelman.gradle.plugins:shadow:6.0.0'
classpath 'edu.sc.seis.launch4j:launch4j:2.4.9'
}
}

Expand All @@ -14,9 +16,13 @@ apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'css'
apply plugin: 'edu.sc.seis.launch4j'

group 'net.querz.mcaselector'
version '1.13.3'
version '1.14'
def appName = 'MCA Selector'
def appUrl = 'https://github.com/Querz/mcaselector'
def appAuthor = 'Querz'

sourceCompatibility = 1.8

Expand All @@ -32,23 +38,25 @@ repositories {
}

dependencies {
implementation 'com.github.Querz:NBT:little-endian-io-SNAPSHOT'
implementation 'com.github.Querz:NBT:4192a95c9d'
implementation 'org.json:json:20201115'
implementation 'ar.com.hjg:pngj:2.1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'commons-io:commons-io:2.6'
}

jar {
archiveFileName = project.name + '-' + project.version + '-min.jar'
archiveFileName = "${project.name}-${project.version}-min.jar"
manifest.attributes 'Main-Class': 'net.querz.mcaselector.Main', 'Application-Version': project.version
from 'LICENSE'
}

shadowJar {
minimize()
archiveFileName = project.name + '-' + project.version + '.jar'
archiveFileName = "${project.name}-${project.version}.jar"
project.configurations.implementation.canBeResolved = true
configurations = [project.configurations.implementation]
exclude 'LICENSE.txt', 'NOTICE.txt'
from 'LICENSE'
}

Expand All @@ -62,8 +70,51 @@ minifyCss {
dest = "${sourceSets.main.output.resourcesDir}/style.css"
}

createExe {
dontWrapJar true
jar "${project.name}.jar"
outfile "${appName}.exe"
icon "${rootProject.projectDir}/inno/icon.ico"
bundledJrePath 'jre'
maxHeapSize 8192
}

task installer {
doLast {
def innoSetupDir = new File("${buildDir}/inno")

delete innoSetupDir
innoSetupDir.mkdir()

copy {
from("${rootProject.projectDir}/inno/icon.ico")
from("${rootProject.projectDir}/inno/small.bmp")
from("${rootProject.projectDir}/inno/large.bmp")
from("${buildDir}/libs/${project.name}-${project.version}.jar")
from("${buildDir}/launch4j/${appName}.exe")
from("${rootProject.projectDir}/LICENSE")
from("${rootProject.projectDir}/7za.exe")
into(innoSetupDir)
rename("${project.name}-${project.version}.jar", "${project.name}.jar")
}

copy {
from("${rootProject.projectDir}/inno/inno.iss")
expand([
applicationVersion: project.version,
applicationName: appName,
applicationUrl: appUrl,
applicationAuthor: appAuthor,
applicationJar: "${project.name}.jar"
])
into(innoSetupDir)
}
}
}

jar.finalizedBy shadowJar
jar.dependsOn minifyCss
assemble.dependsOn shadowJar

task updateReadme {
doLast {
Expand Down
Binary file added inno/icon.ico
Binary file not shown.
97 changes: 97 additions & 0 deletions inno/inno.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[Setup]
AppId={{C6145D1F-C820-492A-A649-F4D4C063EECB}
AppName=${applicationName}
AppVersion=${applicationVersion}
;AppVerName=${applicationName} ${applicationVersion}
AppPublisher=${applicationAuthor}
AppPublisherURL=${applicationUrl}
AppSupportURL=${applicationUrl}
AppUpdatesURL=${applicationUrl}
DefaultDirName={autopf}\\${applicationName}
DisableProgramGroupPage=yes
LicenseFile=LICENSE
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputBaseFilename=MCA_Selector_Setup
SetupIconFile=icon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
WizardSmallImageFile=small.bmp
WizardImageFile=large.bmp
ExtraDiskSpaceRequired=178204672

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\\BrazilianPortuguese.isl"
Name: "czech"; MessagesFile: "compiler:Languages\\Czech.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\\Dutch.isl"
Name: "french"; MessagesFile: "compiler:Languages\\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\\German.isl"
Name: "italian"; MessagesFile: "compiler:Languages\\Italian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\\Russian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\\Spanish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "${applicationName}.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "7za.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "${applicationJar}"; DestDir: "{app}"; Flags: ignoreversion

[UninstallDelete]
Type: filesandordirs; Name: "{app}\\jre"

[Icons]
Name: "{autoprograms}\\${applicationName}"; Filename: "{app}\\${applicationName}.exe"
Name: "{autodesktop}\\${applicationName}"; Filename: "{app}\\${applicationName}.exe"; Tasks: desktopicon

[Run]
Filename: "{tmp}\\7za.exe"; Parameters: "x -y {tmp}\\jre.zip"; WorkingDir: "{app}"; AfterInstall: RenameJRE; Flags: runhidden
Filename: "{app}\\${applicationName}.exe"; Description: "{cm:LaunchProgram,${applicationName}}"; Flags: nowait postinstall skipifsilent

[Code]
var DownloadPage: TDownloadWizardPage;
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
begin
if Progress = ProgressMax then
Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));
Result := True;
end;
procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpReady then begin
DownloadPage.Clear;
DownloadPage.Add('https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-fx-jre8.0.282-win_x64.zip', 'jre.zip', '');
DownloadPage.Show;
try
try
DownloadPage.Download;
Result := True;
except
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end else
Result := True;
end;
procedure RenameJRE;
begin
Log('Renaming jre directory');
RenameFile(ExpandConstant('{app}\\zulu8.52.0.23-ca-fx-jre8.0.282-win_x64'), ExpandConstant('{app}\\jre'));
end;
Binary file added inno/large.bmp
Binary file not shown.
Binary file added inno/small.bmp
Binary file not shown.
40 changes: 39 additions & 1 deletion src/main/java/net/querz/mcaselector/Config.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.querz.mcaselector;

import net.querz.mcaselector.io.FileHelper;
import net.querz.mcaselector.io.WorldDirectories;
import net.querz.mcaselector.tiles.Tile;
import net.querz.mcaselector.ui.Color;
import net.querz.mcaselector.debug.Debug;
Expand Down Expand Up @@ -100,8 +102,10 @@ private static String resolveHome(String dir) {
public static final boolean DEFAULT_SHADE = true;
public static final boolean DEFAULT_SHADE_WATER = true;
public static final boolean DEFAULT_DEBUG = false;
public static final String DEFAULT_MC_SAVES_DIR = FileHelper.getMCSavesDir();

private static File worldDir = null;
private static WorldDirectories worldDirs = null;
private static UUID worldUUID = null;
private static File baseCacheDir = DEFAULT_BASE_CACHE_DIR;
private static File logFile = DEFAULT_BASE_LOG_FILE;
Expand All @@ -117,10 +121,11 @@ private static String resolveHome(String dir) {
private static int maxLoadedFiles = DEFAULT_MAX_LOADED_FILES;
private static boolean shade = DEFAULT_SHADE;
private static boolean shadeWater = DEFAULT_SHADE_WATER;
private static String mcSavesDir = DEFAULT_MC_SAVES_DIR;

private static boolean debug = DEFAULT_DEBUG;

public static final float MAX_SCALE = 7.9999f;
public static final float MAX_SCALE = 15.9999f;
public static final float MIN_SCALE = 0.2f;
public static final double IMAGE_POOL_SIZE = 2.5;

Expand All @@ -130,8 +135,28 @@ public static File getWorldDir() {
return worldDir;
}

public static WorldDirectories getWorldDirs() {
return worldDirs;
}

public static void setWorldDir(File worldDir) {
Config.worldDir = worldDir;
Config.worldDirs = new WorldDirectories(worldDir, null, null);
worldUUID = UUID.nameUUIDFromBytes(worldDir.getAbsolutePath().getBytes());
cacheDir = new File(baseCacheDir, worldUUID.toString().replace("-", ""));
}

public static void setWorldDirs(File regionDir, File poiDir, File entitiesDir) {
Config.worldDirs = new WorldDirectories(regionDir, poiDir, entitiesDir);
Config.worldDir = regionDir;
worldUUID = UUID.nameUUIDFromBytes(worldDir.getAbsolutePath().getBytes());
cacheDir = new File(baseCacheDir, worldUUID.toString().replace("-", ""));
}

public static void setWorldDirs(WorldDirectories dirs) {
Debug.dumpf("setting world directories to %s", dirs);
Config.worldDirs = dirs;
Config.worldDir = dirs.getRegion();
worldUUID = UUID.nameUUIDFromBytes(worldDir.getAbsolutePath().getBytes());
cacheDir = new File(baseCacheDir, worldUUID.toString().replace("-", ""));
}
Expand Down Expand Up @@ -193,6 +218,14 @@ public static boolean shadeWater() {
return Config.shadeWater;
}

public static void setMCSavesDir(String mcSavesDir) {
Config.mcSavesDir = mcSavesDir;
}

public static String getMCSavesDir() {
return Config.mcSavesDir;
}

public static void setDebug(boolean debug) {
if (debug && !Config.debug) {
Config.debug = true;
Expand Down Expand Up @@ -270,6 +303,10 @@ public static void loadFromIni() {
maxLoadedFiles = Integer.parseInt(config.getOrDefault("MaxLoadedFiles", DEFAULT_MAX_LOADED_FILES + ""));
shade = Boolean.parseBoolean(config.getOrDefault("Shade", DEFAULT_SHADE + ""));
shadeWater = Boolean.parseBoolean(config.getOrDefault("ShadeWater", DEFAULT_SHADE_WATER + ""));
mcSavesDir = config.getOrDefault("MCSavesDir", DEFAULT_MC_SAVES_DIR);
if (!new File(mcSavesDir).exists()) {
mcSavesDir = DEFAULT_MC_SAVES_DIR;
}
debug = Boolean.parseBoolean(config.getOrDefault("Debug", DEFAULT_DEBUG + ""));
} catch (Exception ex) {
Debug.dumpException("error loading settings", ex);
Expand Down Expand Up @@ -297,6 +334,7 @@ public static void exportConfig() {
addSettingsLine("MaxLoadedFiles", maxLoadedFiles, DEFAULT_MAX_LOADED_FILES, lines);
addSettingsLine("Shade", shade, DEFAULT_SHADE, lines);
addSettingsLine("ShadeWater", shadeWater, DEFAULT_SHADE_WATER, lines);
addSettingsLine("MCSavesDir", mcSavesDir, DEFAULT_MC_SAVES_DIR, lines);
addSettingsLine("Debug", debug, DEFAULT_DEBUG, lines);
if (lines.size() == 0) {
if (DEFAULT_BASE_CONFIG_FILE.exists() && !DEFAULT_BASE_CONFIG_FILE.delete()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/querz/mcaselector/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
Debug.dumpf("java version: %s", System.getProperty("java.version"));
Debug.dumpf("jvm max mem: %d", Runtime.getRuntime().maxMemory());

Future<Boolean> headless = new ParamExecutor(args).parseAndRun();
Future<Boolean> headless = new ParamExecutor(args).run();
if (headless != null && headless.get()) {
// we already ran headless mode, so we exit here
Debug.print("exiting");
Expand Down
Loading

0 comments on commit aecf5fd

Please sign in to comment.