Build script reformatting / 'Fixed' all unchecked warnings
This commit is contained in:
@@ -107,8 +107,6 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor{
|
|||||||
ClassEntry clas = new ClassEntry(callLocation);
|
ClassEntry clas = new ClassEntry(callLocation);
|
||||||
classMap.put(callLocation, clas);
|
classMap.put(callLocation, clas);
|
||||||
classes.add(clas);
|
classes.add(clas);
|
||||||
|
|
||||||
Utils.messager.printMessage(Kind.NOTE, "Generating class '" + clas.name + "'.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassEntry entry = classMap.get(callLocation);
|
ClassEntry entry = classMap.get(callLocation);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class SerializeAnnotationProcessor extends AbstractProcessor{
|
|||||||
Set<TypeElement> elements = ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(Serialize.class));
|
Set<TypeElement> elements = ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(Serialize.class));
|
||||||
|
|
||||||
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
|
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
|
||||||
|
classBuilder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "\"unchecked\"").build());
|
||||||
MethodSpec.Builder method = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
MethodSpec.Builder method = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
|
|
||||||
for(TypeElement elem : elements){
|
for(TypeElement elem : elements){
|
||||||
|
|||||||
+41
-40
@@ -1,26 +1,26 @@
|
|||||||
buildscript {
|
buildscript{
|
||||||
repositories {
|
repositories{
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies{
|
||||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0'
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
|
||||||
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
|
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects{
|
||||||
apply plugin: "idea"
|
apply plugin: "idea"
|
||||||
|
|
||||||
version = 'release'
|
version = 'release'
|
||||||
|
|
||||||
ext {
|
ext{
|
||||||
versionNumber = '4'
|
versionNumber = '4'
|
||||||
versionModifier = 'alpha'
|
versionModifier = 'alpha'
|
||||||
if (!project.hasProperty("versionType")) versionType = 'official'
|
if(!project.hasProperty("versionType")) versionType = 'official'
|
||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.9'
|
gdxVersion = '1.9.9'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
@@ -43,7 +43,7 @@ allprojects {
|
|||||||
generateLocales = {
|
generateLocales = {
|
||||||
def output = 'en\n'
|
def output = 'en\n'
|
||||||
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
||||||
bundles.listFiles().each { other ->
|
bundles.listFiles().each{ other ->
|
||||||
if(other.name == "bundle.properties") return
|
if(other.name == "bundle.properties") return
|
||||||
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
|
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
|
||||||
}
|
}
|
||||||
@@ -56,9 +56,9 @@ allprojects {
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
pfile.createNewFile()
|
pfile.createNewFile()
|
||||||
}catch (Exception ignored){}
|
}catch(Exception ignored){}
|
||||||
|
|
||||||
if(pfile.exists()) {
|
if(pfile.exists()){
|
||||||
|
|
||||||
props.load(new FileInputStream(pfile))
|
props.load(new FileInputStream(pfile))
|
||||||
|
|
||||||
@@ -74,19 +74,19 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories{
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
|
maven{ url "https://oss.sonatype.org/content/repositories/releases/" }
|
||||||
maven { url 'https://jitpack.io' }
|
maven{ url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":desktop") {
|
project(":desktop"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile project(":kryonet")
|
compile project(":kryonet")
|
||||||
if(new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null) compile project(":debug")
|
if(new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null) compile project(":debug")
|
||||||
@@ -99,14 +99,14 @@ project(":desktop") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":ios") {
|
project(":ios"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
apply plugin: "robovm"
|
apply plugin: "robovm"
|
||||||
|
|
||||||
task copyGen{
|
task copyGen{
|
||||||
doLast {
|
doLast{
|
||||||
copy {
|
copy{
|
||||||
from("../core/build/classes/java/main/io/anuke/mindustry/gen/") {
|
from("../core/build/classes/java/main/io/anuke/mindustry/gen/"){
|
||||||
include "**/*.java"
|
include "**/*.java"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,14 +134,16 @@ project(":ios") {
|
|||||||
props['app.mainclass'] = 'io.anuke.mindustry.IOSLauncher'
|
props['app.mainclass'] = 'io.anuke.mindustry.IOSLauncher'
|
||||||
props['app.executable'] = 'IOSLauncher'
|
props['app.executable'] = 'IOSLauncher'
|
||||||
props['app.name'] = 'Mindustry'
|
props['app.name'] = 'Mindustry'
|
||||||
props['app.build'] = (!props.containsKey("app.build") ? 40 : props['app.build'].toInteger() + 1)+""
|
props['app.build'] = (!props.containsKey("app.build") ? 40 : props['app.build'].toInteger() + 1) + ""
|
||||||
props.store(vfile.newWriter(), null)
|
props.store(vfile.newWriter(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
build.dependsOn(incrementConfig)
|
build.dependsOn(incrementConfig)
|
||||||
build.dependsOn(copyGen)
|
if(file('robovm.properties').exists()){
|
||||||
|
build.dependsOn(copyGen)
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
implementation project(":kryonet")
|
implementation project(":kryonet")
|
||||||
|
|
||||||
@@ -150,18 +152,17 @@ project(":ios") {
|
|||||||
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
|
||||||
//compileOnly project(":annotations")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":core") {
|
project(":core"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
task finish {
|
task finish{
|
||||||
generateLocales()
|
generateLocales()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
build.finalizedBy(finish)
|
build.finalizedBy(finish)
|
||||||
|
|
||||||
def comp = System.properties["release"] == null || System.properties["release"] == "false"
|
def comp = System.properties["release"] == null || System.properties["release"] == "false"
|
||||||
@@ -173,7 +174,7 @@ project(":core") {
|
|||||||
compile "com.github.anuken:ucore:$uCoreVersion"
|
compile "com.github.anuken:ucore:$uCoreVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
if(new File(projectDir.parent, '../GDXGifRecorder').exists() && comp) {
|
if(new File(projectDir.parent, '../GDXGifRecorder').exists() && comp){
|
||||||
compile project(":GDXGifRecorder")
|
compile project(":GDXGifRecorder")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,16 +187,16 @@ project(":core") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":server") {
|
project(":server"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
configurations {
|
configurations{
|
||||||
if(findProject(":android") != null){
|
if(findProject(":android") != null){
|
||||||
compile.exclude module: android
|
compile.exclude module: android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
|
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile project(":kryonet")
|
compile project(":kryonet")
|
||||||
@@ -207,7 +208,7 @@ project(":server") {
|
|||||||
project(":tests"){
|
project(":tests"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
testImplementation project(":core")
|
testImplementation project(":core")
|
||||||
testImplementation('org.junit.jupiter:junit-jupiter-api:5.1.0')
|
testImplementation('org.junit.jupiter:junit-jupiter-api:5.1.0')
|
||||||
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.1.0')
|
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.1.0')
|
||||||
@@ -215,32 +216,32 @@ project(":tests"){
|
|||||||
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test{
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
workingDir = new File("../core/assets")
|
workingDir = new File("../core/assets")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":tools") {
|
project(":tools"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":annotations") {
|
project(":annotations"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
compile 'com.squareup:javapoet:1.11.0'
|
compile 'com.squareup:javapoet:1.11.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project(":kryonet") {
|
project(":kryonet"){
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies{
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile "org.lz4:lz4-java:1.4.1"
|
compile "org.lz4:lz4-java:1.4.1"
|
||||||
compile 'com.github.Anuken:kryonet:53b10247b1'
|
compile 'com.github.Anuken:kryonet:53b10247b1'
|
||||||
|
|||||||
@@ -2,3 +2,7 @@ apply plugin: "java"
|
|||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
sourceSets.main.java.srcDirs = ["src/"]
|
sourceSets.main.java.srcDirs = ["src/"]
|
||||||
|
|
||||||
|
compileJava{
|
||||||
|
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||||
|
}
|
||||||
@@ -95,26 +95,24 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
t.addImageTextButton("$text.editor.import", "icon-load-map", isize, () ->
|
t.addImageTextButton("$text.editor.import", "icon-load-map", isize, () ->
|
||||||
createDialog("$text.editor.import",
|
createDialog("$text.editor.import",
|
||||||
"$text.editor.importmap", "$text.editor.importmap.description", "icon-load-map", (Runnable) loadDialog::show,
|
"$text.editor.importmap", "$text.editor.importmap.description", "icon-load-map", (Runnable) loadDialog::show,
|
||||||
"$text.editor.importfile", "$text.editor.importfile.description", "icon-file", (Runnable) () -> {
|
"$text.editor.importfile", "$text.editor.importfile.description", "icon-file", (Runnable) () ->
|
||||||
Platform.instance.showFileChooser("$text.loadimage", "Map Files", file -> {
|
Platform.instance.showFileChooser("$text.loadimage", "Map Files", file -> ui.loadGraphics(() -> {
|
||||||
ui.loadGraphics(() -> {
|
try{
|
||||||
try{
|
DataInputStream stream = new DataInputStream(file.read());
|
||||||
DataInputStream stream = new DataInputStream(file.read());
|
|
||||||
|
|
||||||
MapMeta meta = MapIO.readMapMeta(stream);
|
MapMeta meta = MapIO.readMapMeta(stream);
|
||||||
MapTileData data = MapIO.readTileData(stream, meta, false);
|
MapTileData data = MapIO.readTileData(stream, meta, false);
|
||||||
|
|
||||||
editor.beginEdit(data, meta.tags, false);
|
editor.beginEdit(data, meta.tags, false);
|
||||||
view.clearStack();
|
view.clearStack();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
|
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
});
|
}), true, mapExtension),
|
||||||
}, true, mapExtension);
|
|
||||||
},
|
"$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Runnable)() ->
|
||||||
"$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Runnable)() -> {
|
Platform.instance.showFileChooser("$text.loadimage", "Image Files", file ->
|
||||||
Platform.instance.showFileChooser("$text.loadimage", "Image Files", file -> {
|
|
||||||
ui.loadGraphics(() -> {
|
ui.loadGraphics(() -> {
|
||||||
try{
|
try{
|
||||||
MapTileData data = MapIO.readLegacyPixmap(new Pixmap(file));
|
MapTileData data = MapIO.readLegacyPixmap(new Pixmap(file));
|
||||||
@@ -125,12 +123,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
|
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
});
|
}), true, "png")
|
||||||
}, true, "png");
|
));
|
||||||
}));
|
|
||||||
|
|
||||||
t.addImageTextButton("$text.editor.export", "icon-save-map", isize, () -> createDialog("$text.editor.export",
|
t.addImageTextButton("$text.editor.export", "icon-save-map", isize, () -> createDialog("$text.editor.export",
|
||||||
"$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Runnable) () -> {
|
"$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Runnable) () ->
|
||||||
Platform.instance.showFileChooser("$text.saveimage", "Map Files", file -> {
|
Platform.instance.showFileChooser("$text.saveimage", "Map Files", file -> {
|
||||||
file = file.parent().child(file.nameWithoutExtension() + "." + mapExtension);
|
file = file.parent().child(file.nameWithoutExtension() + "." + mapExtension);
|
||||||
FileHandle result = file;
|
FileHandle result = file;
|
||||||
@@ -146,8 +143,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, false, mapExtension);
|
}, false, mapExtension)));
|
||||||
}));
|
|
||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
@@ -258,7 +254,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
* 2) icon name
|
* 2) icon name
|
||||||
* 3) listener
|
* 3) listener
|
||||||
*/
|
*/
|
||||||
private FloatingDialog createDialog(String title, Object... arguments){
|
private void createDialog(String title, Object... arguments){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
FloatingDialog dialog = new FloatingDialog(title);
|
||||||
|
|
||||||
float h = 90f;
|
float h = 90f;
|
||||||
@@ -292,8 +288,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
return dialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -556,9 +550,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
ImageButton button = new ImageButton("white", "clear-toggle");
|
ImageButton button = new ImageButton("white", "clear-toggle");
|
||||||
button.clicked(() -> editor.setDrawBlock(block));
|
button.clicked(() -> editor.setDrawBlock(block));
|
||||||
button.resizeImage(8 * 4f);
|
button.resizeImage(8 * 4f);
|
||||||
button.getImageCell().setActor(stack);
|
button.replaceImage(stack);
|
||||||
button.addChild(stack);
|
|
||||||
button.getImage().remove();
|
|
||||||
button.update(() -> button.setChecked(editor.getDrawBlock() == block));
|
button.update(() -> button.setChecked(editor.getDrawBlock() == block));
|
||||||
group.add(button);
|
group.add(button);
|
||||||
content.add(button).size(50f);
|
content.add(button).size(50f);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public class Unlocks{
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void load(){
|
public void load(){
|
||||||
unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new);
|
unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class Sectors{
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void load(){
|
public void load(){
|
||||||
for(Sector sector : grid.values()){
|
for(Sector sector : grid.values()){
|
||||||
sector.texture.dispose();
|
sector.texture.dispose();
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ public class Administration{
|
|||||||
Settings.save();
|
Settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void load(){
|
private void load(){
|
||||||
playerInfo = Settings.getObject("player-info", ObjectMap.class, ObjectMap::new);
|
playerInfo = Settings.getObject("player-info", ObjectMap.class, ObjectMap::new);
|
||||||
bannedIPs = Settings.getObject("banned-ips", Array.class, Array::new);
|
bannedIPs = Settings.getObject("banned-ips", Array.class, Array::new);
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public class Net{
|
public class Net{
|
||||||
private static boolean server;
|
private static boolean server;
|
||||||
private static boolean active;
|
private static boolean active;
|
||||||
private static boolean clientLoaded;
|
private static boolean clientLoaded;
|
||||||
private static String lastIP;
|
|
||||||
private static Array<Object> packetQueue = new Array<>();
|
private static Array<Object> packetQueue = new Array<>();
|
||||||
private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>();
|
private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>();
|
||||||
private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>();
|
private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>();
|
||||||
@@ -106,7 +106,6 @@ public class Net{
|
|||||||
*/
|
*/
|
||||||
public static void connect(String ip, int port, Runnable success){
|
public static void connect(String ip, int port, Runnable success){
|
||||||
try{
|
try{
|
||||||
lastIP = ip + ":" + port;
|
|
||||||
if(!active){
|
if(!active){
|
||||||
clientProvider.connect(ip, port, success);
|
clientProvider.connect(ip, port, success);
|
||||||
active = true;
|
active = true;
|
||||||
@@ -119,11 +118,6 @@ public class Net{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Returns the last IP connected to.*/
|
|
||||||
public static String getLastIP() {
|
|
||||||
return lastIP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Host a server at an address.
|
* Host a server at an address.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -310,6 +310,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
return UIUtils.portrait() ? 350f : 500f;
|
return UIUtils.portrait() ? 350f : 500f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void loadServers(){
|
private void loadServers(){
|
||||||
servers = Settings.getObject("server-list", Array.class, Array::new);
|
servers = Settings.getObject("server-list", Array.class, Array::new);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class Tile implements PosTrait, TargetTrait{
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends TileEntity> T entity(){
|
public <T extends TileEntity> T entity(){
|
||||||
return (T) entity;
|
return (T) entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class Conveyor extends Block{
|
|||||||
private TextureRegion[][] regions = new TextureRegion[7][4];
|
private TextureRegion[][] regions = new TextureRegion[7][4];
|
||||||
|
|
||||||
protected float speed = 0f;
|
protected float speed = 0f;
|
||||||
protected float carryCapacity = 8f;
|
|
||||||
|
|
||||||
protected Conveyor(String name){
|
protected Conveyor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -359,9 +358,9 @@ public class Conveyor extends Block{
|
|||||||
public Array<Object> getDebugInfo(Tile tile){
|
public Array<Object> getDebugInfo(Tile tile){
|
||||||
ConveyorEntity entity = tile.entity();
|
ConveyorEntity entity = tile.entity();
|
||||||
Array<Object> arr = super.getDebugInfo(tile);
|
Array<Object> arr = super.getDebugInfo(tile);
|
||||||
arr.addAll(Array.with(
|
arr.addAll(Array.<Object>with(
|
||||||
"clogHeat", entity.clogHeat,
|
"clogHeat", entity.clogHeat,
|
||||||
"sleeping", entity.isSleeping()
|
"sleeping", entity.isSleeping()
|
||||||
));
|
));
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public class Consumers{
|
|||||||
return map.containsKey(type);
|
return map.containsKey(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Consume> T get(Class<T> type){
|
public <T extends Consume> T get(Class<T> type){
|
||||||
if(!map.containsKey(type)){
|
if(!map.containsKey(type)){
|
||||||
throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!");
|
throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!");
|
||||||
|
|||||||
+27
-27
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
sourceSets.main.java.srcDirs = ["src/"]
|
||||||
|
|
||||||
project.ext.mainClassName = "io.anuke.mindustry.desktop.DesktopLauncher"
|
project.ext.mainClassName = "io.anuke.mindustry.desktop.DesktopLauncher"
|
||||||
project.ext.assetsDir = new File("../core/assets")
|
project.ext.assetsDir = new File("../core/assets")
|
||||||
@@ -10,25 +10,25 @@ def PACKR_DIR = "$System.env.PACKR_DIR"
|
|||||||
def ICON_DIR = new File("core/assets/sprites/icon.icns")
|
def ICON_DIR = new File("core/assets/sprites/icon.icns")
|
||||||
|
|
||||||
ext.getPlatform = {
|
ext.getPlatform = {
|
||||||
if (project.hasProperty("platform")) {
|
if(project.hasProperty("platform")){
|
||||||
def lc = platform.toLowerCase()
|
def lc = platform.toLowerCase()
|
||||||
if (lc == "windows64") {
|
if(lc == "windows64"){
|
||||||
return "windows64"
|
return "windows64"
|
||||||
} else if (lc == "windows32") {
|
}else if(lc == "windows32"){
|
||||||
return "windows32"
|
return "windows32"
|
||||||
} else if (lc == "linux") {
|
}else if(lc == "linux"){
|
||||||
return "linux64"
|
return "linux64"
|
||||||
} else if (lc == "mac") {
|
}else if(lc == "mac"){
|
||||||
return "mac"
|
return "mac"
|
||||||
} else {
|
}else{
|
||||||
throw new InvalidUserDataException("Invalid platform. Set platform with -Pplatform=windows/linux/mac")
|
throw new InvalidUserDataException("Invalid platform. Set platform with -Pplatform=windows/linux/mac")
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
throw new InvalidUserDataException("No platform defined. Set platform with -Pplatform=windows/linux/mac")
|
throw new InvalidUserDataException("No platform defined. Set platform with -Pplatform=windows/linux/mac")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec){
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
@@ -37,7 +37,7 @@ task run(dependsOn: classes, type: JavaExec) {
|
|||||||
jvmArgs "-XstartOnFirstThread"
|
jvmArgs "-XstartOnFirstThread"
|
||||||
}
|
}
|
||||||
ignoreExitValue = true
|
ignoreExitValue = true
|
||||||
if (project.hasProperty("args")) {
|
if(project.hasProperty("args")){
|
||||||
args Eval.me(project.getProperties()["args"])
|
args Eval.me(project.getProperties()["args"])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ task run(dependsOn: classes, type: JavaExec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task debug(dependsOn: classes, type: JavaExec) {
|
task debug(dependsOn: classes, type: JavaExec){
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
@@ -55,38 +55,38 @@ task debug(dependsOn: classes, type: JavaExec) {
|
|||||||
debug = true
|
debug = true
|
||||||
}
|
}
|
||||||
|
|
||||||
task dist(type: Jar) {
|
task dist(type: Jar){
|
||||||
dependsOn classes
|
dependsOn classes
|
||||||
|
|
||||||
writeVersion()
|
writeVersion()
|
||||||
|
|
||||||
from files(sourceSets.main.output.classesDirs)
|
from files(sourceSets.main.output.classesDirs)
|
||||||
from files(sourceSets.main.output.resourcesDir)
|
from files(sourceSets.main.output.resourcesDir)
|
||||||
from {configurations.compile.collect {zipTree(it)}}
|
from{ configurations.compile.collect{ zipTree(it) } }
|
||||||
from files(project.assetsDir)
|
from files(project.assetsDir)
|
||||||
|
|
||||||
manifest {
|
manifest{
|
||||||
attributes 'Main-Class': project.mainClassName
|
attributes 'Main-Class': project.mainClassName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clearOut(type: Delete){
|
task clearOut(type: Delete){
|
||||||
doLast {
|
doLast{
|
||||||
delete "packr-out/"
|
delete "packr-out/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//note: call desktop:dist beforehand
|
//note: call desktop:dist beforehand
|
||||||
task packrCmd() {
|
task packrCmd(){
|
||||||
|
|
||||||
doLast {
|
doLast{
|
||||||
|
|
||||||
copy {
|
copy{
|
||||||
into PACKR_DIR
|
into PACKR_DIR
|
||||||
from "build/libs/desktop-release.jar"
|
from "build/libs/desktop-release.jar"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec {
|
exec{
|
||||||
|
|
||||||
commandLine("java", "-jar", PACKR_DIR + "packr.jar",
|
commandLine("java", "-jar", PACKR_DIR + "packr.jar",
|
||||||
"--verbose",
|
"--verbose",
|
||||||
@@ -104,7 +104,7 @@ task packrCmd() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task fixMac (type: Copy){
|
task fixMac(type: Copy){
|
||||||
dependsOn "packrCmd"
|
dependsOn "packrCmd"
|
||||||
|
|
||||||
into "packr-out/" + appName + ".app/Contents/"
|
into "packr-out/" + appName + ".app/Contents/"
|
||||||
@@ -117,12 +117,12 @@ task fixMac (type: Copy){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task fixWindows32 (type: Copy){
|
task fixWindows32(type: Copy){
|
||||||
dependsOn "packrCmd"
|
dependsOn "packrCmd"
|
||||||
|
|
||||||
into "packr-out/jre/bin/"
|
into "packr-out/jre/bin/"
|
||||||
from PACKR_DIR + "zip.dll"
|
from PACKR_DIR + "zip.dll"
|
||||||
rename ("zip.dll", "ojdkbuild_zlib.dll")
|
rename("zip.dll", "ojdkbuild_zlib.dll")
|
||||||
|
|
||||||
doLast{
|
doLast{
|
||||||
copy{
|
copy{
|
||||||
@@ -132,21 +132,21 @@ task fixWindows32 (type: Copy){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task packrZip() {
|
task packrZip(){
|
||||||
dependsOn "packrCmd"
|
dependsOn "packrCmd"
|
||||||
finalizedBy "clearOut"
|
finalizedBy "clearOut"
|
||||||
|
|
||||||
if(project.hasProperty("platform")) {
|
if(project.hasProperty("platform")){
|
||||||
|
|
||||||
if (getPlatform() == "mac") {
|
if(getPlatform() == "mac"){
|
||||||
dependsOn "fixMac"
|
dependsOn "fixMac"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getPlatform() == "windows32") {
|
if(getPlatform() == "windows32"){
|
||||||
dependsOn "fixWindows32"
|
dependsOn "fixWindows32"
|
||||||
}
|
}
|
||||||
|
|
||||||
task zip (type: Zip){
|
task zip(type: Zip){
|
||||||
from "packr-out/"
|
from "packr-out/"
|
||||||
archiveName "$appName-${getPlatform()}-${getVersionString()}.zip"
|
archiveName "$appName-${getPlatform()}-${getVersionString()}.zip"
|
||||||
destinationDir(file("packr-export"))
|
destinationDir(file("packr-export"))
|
||||||
|
|||||||
+11
-11
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
sourceSets.main.java.srcDirs = ["src/"]
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
||||||
@@ -12,25 +12,25 @@ def textureFolder = "../core/assets-raw/sprites/generated/"
|
|||||||
|
|
||||||
task swapColors(){
|
task swapColors(){
|
||||||
doLast{
|
doLast{
|
||||||
if (project.hasProperty("colors")) {
|
if(project.hasProperty("colors")){
|
||||||
def carr = new File(getProperty("colors")).text.split("\n")
|
def carr = new File(getProperty("colors")).text.split("\n")
|
||||||
def map = [:]
|
def map = [:]
|
||||||
def swaps = 0
|
def swaps = 0
|
||||||
carr.each {str -> map[Color.argb8888(Color.valueOf(str.split("=")[0]))] = Color.argb8888(Color.valueOf(str.split("=")[1]))}
|
carr.each{ str -> map[Color.argb8888(Color.valueOf(str.split("=")[0]))] = Color.argb8888(Color.valueOf(str.split("=")[1])) }
|
||||||
def tmpc = new Color()
|
def tmpc = new Color()
|
||||||
|
|
||||||
fileTree(dir: '../core/assets-raw/sprites', include: "**/*.png").visit { file ->
|
fileTree(dir: '../core/assets-raw/sprites', include: "**/*.png").visit{ file ->
|
||||||
if(file.isDirectory()) return
|
if(file.isDirectory()) return
|
||||||
swaps ++
|
swaps++
|
||||||
|
|
||||||
def img = ImageIO.read(file.file)
|
def img = ImageIO.read(file.file)
|
||||||
for (x in (0..img.getWidth()-1)) {
|
for(x in (0..img.getWidth() - 1)){
|
||||||
for (y in (0..img.getHeight()-1)) {
|
for(y in (0..img.getHeight() - 1)){
|
||||||
def c = img.getRGB(x, y)
|
def c = img.getRGB(x, y)
|
||||||
Color.argb8888ToColor(tmpc, c)
|
Color.argb8888ToColor(tmpc, c)
|
||||||
if(tmpc.a < 0.1f) continue
|
if(tmpc.a < 0.1f) continue
|
||||||
if(map.containsKey(c)){
|
if(map.containsKey(c)){
|
||||||
img.setRGB(x, y, (int)map.get(c))
|
img.setRGB(x, y, (int) map.get(c))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ task swapColors(){
|
|||||||
task pack(){
|
task pack(){
|
||||||
dependsOn 'prePack'
|
dependsOn 'prePack'
|
||||||
|
|
||||||
doLast {
|
doLast{
|
||||||
TexturePacker.process("core/assets-raw/sprites/", "core/assets/sprites/", "sprites.atlas")
|
TexturePacker.process("core/assets-raw/sprites/", "core/assets/sprites/", "sprites.atlas")
|
||||||
|
|
||||||
delete{
|
delete{
|
||||||
@@ -71,7 +71,7 @@ task cleanup(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task generateSprites(dependsOn: classes, type: JavaExec) {
|
task generateSprites(dependsOn: classes, type: JavaExec){
|
||||||
file(textureFolder).mkdirs()
|
file(textureFolder).mkdirs()
|
||||||
|
|
||||||
main = "io.anuke.mindustry.PackerLauncher"
|
main = "io.anuke.mindustry.PackerLauncher"
|
||||||
@@ -80,7 +80,7 @@ task generateSprites(dependsOn: classes, type: JavaExec) {
|
|||||||
workingDir = textureFolder
|
workingDir = textureFolder
|
||||||
}
|
}
|
||||||
|
|
||||||
task updateBundles(dependsOn: classes, type: JavaExec) {
|
task updateBundles(dependsOn: classes, type: JavaExec){
|
||||||
file(textureFolder).mkdirs()
|
file(textureFolder).mkdirs()
|
||||||
|
|
||||||
main = "io.anuke.mindustry.BundleLauncher"
|
main = "io.anuke.mindustry.BundleLauncher"
|
||||||
|
|||||||
Reference in New Issue
Block a user