Véhicules et tenues normalement opérationnels.
This commit is contained in:
parent
01b9c2ea20
commit
0a49860f87
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,14 +1,22 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id "com.github.johnrengelman.shadow" version "5.2.0"
|
||||
}
|
||||
|
||||
|
||||
group 'org.example'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.2'
|
||||
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.2'
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/resources/main/icon.png
Normal file
BIN
build/resources/main/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
build/resources/main/logo_transparent.png
Normal file
BIN
build/resources/main/logo_transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
43
build/resources/main/menu.fxml
Normal file
43
build/resources/main/menu.fxml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<AnchorPane style="-fx-background-color: #303030;" xmlns="http://javafx.com/javafx/8.0.171"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.m4th1eu.flansupdater.FrameController">
|
||||
<Label layoutX="414.0" layoutY="357.0" text="Flans Updater V2 - Développé par M4TH1EU_" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="11.0" fx:id="x3"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Button fx:id="bug" layoutX="182.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Signaler un bug"
|
||||
textFill="WHITE"/>
|
||||
|
||||
<Button fx:id="idea" layoutX="333.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Une idée ?" textFill="WHITE"/>
|
||||
|
||||
<Separator layoutY="347.0" prefHeight="16.0" prefWidth="640.0"/>
|
||||
|
||||
<Button fx:id="convertir" layoutX="197.0" layoutY="200.0" mnemonicParsing="false" prefHeight="48.0"
|
||||
prefWidth="252.0" style="-fx-background-color: transparent; -fx-border-color: white; -fx-border-width: 2;"
|
||||
text="Mettre à jour mon pack" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="20.0"/>
|
||||
</font>
|
||||
</Button>
|
||||
<Button fx:id="selectpack" layoutX="347.0" layoutY="147.0" mnemonicParsing="false" prefHeight="21.0"
|
||||
prefWidth="101.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Choisir un pack"
|
||||
textFill="WHITE"/>
|
||||
<TextField fx:id="packname" layoutX="196.0" layoutY="147.0" prefHeight="27.0" prefWidth="149.0"
|
||||
style="-fx-background-color: transparent; -fx-border-color: white; -fx-text-fill: white"/>
|
||||
<Label layoutX="197.0" layoutY="127.0" text="Nom du pack" textFill="WHITE"/>
|
||||
<ImageView fitHeight="118.0" fitWidth="583.0" layoutX="84.0" layoutY="-4.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@logo_transparent.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</AnchorPane>
|
76
build/resources/main/model.json
Normal file
76
build/resources/main/model.json
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "flansmod:items/your_item_texture"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
90,
|
||||
-35
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
1.25,
|
||||
-2.5
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
},
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
90,
|
||||
-35
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
1.25,
|
||||
-2.5
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
-45,
|
||||
25
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
4,
|
||||
2
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
-45,
|
||||
25
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
4,
|
||||
2
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
package ch.m4th1eu.flansupdater;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -34,7 +33,7 @@ public class ArmorUtils {
|
||||
}
|
||||
|
||||
try {
|
||||
FileWriter myWriter = new FileWriter(NEWFILENAME);
|
||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(NEWFILENAME), StandardCharsets.UTF_8);
|
||||
myWriter.write(processArmorFile(readFile(path.toFile())));
|
||||
myWriter.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -6,10 +6,12 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -53,7 +55,34 @@ public class FileUtils {
|
||||
* @return argument's value
|
||||
*/
|
||||
public static String get(String argument, String content) {
|
||||
Scanner scanner = new Scanner(content);
|
||||
String str;
|
||||
BufferedReader reader = new BufferedReader(new StringReader(content));
|
||||
try {
|
||||
while ((str = reader.readLine()) != null) {
|
||||
if (argument.equals("Name")) {
|
||||
if (str.contains("Name") && !str.contains("ShortName")) {
|
||||
return str.replaceFirst(argument + " ", "");
|
||||
}
|
||||
} else if (str.startsWith(argument)) {
|
||||
return str.replaceFirst(argument + " ", "");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//doesn't work neither
|
||||
/*List<String> lines = new ArrayList<>();
|
||||
try {
|
||||
lines = IOUtils.readLines(new StringReader(content));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return lines.stream().filter(s -> s.startsWith(argument)).findFirst().map(s -> s.replaceFirst(argument + " ", "")).orElse("null");*/
|
||||
|
||||
|
||||
//disabled because I think it skip the firstline
|
||||
/*Scanner scanner = new Scanner(content);
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
|
||||
@ -61,9 +90,9 @@ public class FileUtils {
|
||||
return line.replaceFirst(argument + " ", "");
|
||||
}
|
||||
}
|
||||
scanner.close();
|
||||
scanner.close();*/
|
||||
|
||||
return "null";
|
||||
return "not found";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,12 +127,16 @@ public class FileUtils {
|
||||
* @return file's content
|
||||
*/
|
||||
public static String readFile(File file) {
|
||||
if (!file.exists()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
StringBuilder fileData = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new FileReader(file.toString()));
|
||||
new InputStreamReader(new FileInputStream(file.toString()), StandardCharsets.UTF_8));
|
||||
char[] buf = new char[1024];
|
||||
int numRead = 0;
|
||||
int numRead;
|
||||
while ((numRead = reader.read(buf)) != -1) {
|
||||
String readData = String.valueOf(buf, 0, numRead);
|
||||
fileData.append(readData);
|
||||
@ -137,7 +170,7 @@ public class FileUtils {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
langs.forEach(str -> stringBuilder.append(str).append("\n"));
|
||||
|
||||
FileWriter myWriter = new FileWriter(Main.LANG_NEWPATH + "en_US.lang");
|
||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(Main.LANG_NEWPATH + "en_US.lang"), StandardCharsets.UTF_8);
|
||||
myWriter.write(stringBuilder.toString());
|
||||
myWriter.close();
|
||||
Logger.info("Successfully generated the new lang file.");
|
||||
@ -166,7 +199,7 @@ public class FileUtils {
|
||||
|
||||
public static void createModels(String shortName, String icon) {
|
||||
//check if the models folder exists, if not we create it.
|
||||
File modelsFolder = new File(Main.JSON_PATH);
|
||||
File modelsFolder = new File(Main.JSON_NEWPATH);
|
||||
if (!modelsFolder.exists()) {
|
||||
boolean isCreated = modelsFolder.mkdirs();
|
||||
if (isCreated) {
|
||||
@ -179,14 +212,19 @@ public class FileUtils {
|
||||
String jsonString = "{\"parent\":\"builtin/generated\",\"textures\":{\"layer0\":\"flansmod:items/your_item_texture\"},\"display\":{\"thirdperson_lefthand\":{\"rotation\":[0,90,-35],\"translation\":[0,1.25,-2.5],\"scale\":[0.8,0.8,0.8]},\"thirdperson_righthand\":{\"rotation\":[0,90,-35],\"translation\":[0,1.25,-2.5],\"scale\":[0.8,0.8,0.8]},\"firstperson_lefthand\":{\"rotation\":[0,-45,25],\"translation\":[0,4,2],\"scale\":[0.8,0.8,0.8]},\"firstperson_righthand\":{\"rotation\":[0,-45,25],\"translation\":[0,4,2],\"scale\":[0.8,0.8,0.8]}}}";
|
||||
jsonString = jsonString.replaceFirst("your_item_texture", icon);
|
||||
|
||||
if (Paths.get(Main.JSON_PATH + shortName + ".json").toFile().exists()) {
|
||||
jsonString = readFile(new File(Main.JSON_PATH + shortName + ".json"));
|
||||
}
|
||||
|
||||
try {
|
||||
FileWriter myWriter = new FileWriter(Main.JSON_PATH + shortName + ".json");
|
||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(Main.JSON_NEWPATH + shortName + ".json"), StandardCharsets.UTF_8);
|
||||
myWriter.write(jsonString);
|
||||
myWriter.close();
|
||||
} catch (IOException e) {
|
||||
Logger.error("Cannot create the json model file for : " + shortName);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void copyModels() {
|
||||
@ -199,6 +237,28 @@ public class FileUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void deleteTempsFolder() {
|
||||
recursiveDelete(new File(Main.PACK_PATH));
|
||||
recursiveDelete(new File(Main.NEWPACK_PATH));
|
||||
Logger.info("Sucessfully deleted temporary directories.");
|
||||
}
|
||||
|
||||
|
||||
private static void recursiveDelete(File file) {
|
||||
//to end the recursive loop
|
||||
if (!file.exists())
|
||||
return;
|
||||
|
||||
//if directory, go inside and call recursively
|
||||
if (file.isDirectory()) {
|
||||
//call recursively
|
||||
Arrays.stream(file.listFiles()).forEach(FileUtils::recursiveDelete);
|
||||
}
|
||||
//call delete to delete files and empty directory
|
||||
file.delete();
|
||||
}
|
||||
|
||||
public static void createPackInfo() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
JsonObject pack = new JsonObject();
|
||||
@ -210,7 +270,7 @@ public class FileUtils {
|
||||
String jsonString = gson.toJson(jsonObject);
|
||||
|
||||
try {
|
||||
FileWriter myWriter = new FileWriter(Main.NEWPACK_PATH + "pack_info.mcmeta");
|
||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(Main.NEWPACK_PATH + "pack_info.mcmeta"), StandardCharsets.UTF_8);
|
||||
myWriter.write(jsonString);
|
||||
myWriter.close();
|
||||
Logger.info("Successfully created the pack_info file.");
|
||||
|
141
src/main/java/ch/m4th1eu/flansupdater/FrameController.java
Normal file
141
src/main/java/ch/m4th1eu/flansupdater/FrameController.java
Normal file
@ -0,0 +1,141 @@
|
||||
package ch.m4th1eu.flansupdater;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.FileChooser;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FrameController {
|
||||
@FXML
|
||||
TextField packname;
|
||||
@FXML
|
||||
Button bug;
|
||||
@FXML
|
||||
Button idea;
|
||||
@FXML
|
||||
Button convertir;
|
||||
@FXML
|
||||
Button selectpack;
|
||||
|
||||
private File selectedFile;
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
registerHoverableButton(bug);
|
||||
registerHoverableButton(idea);
|
||||
registerHoverableButton(convertir);
|
||||
registerHoverableButton(selectpack);
|
||||
|
||||
registerLinkableButton(bug, "https://github.com/M4TH1EU/Flan-s-Mod-Updater/issues/new?assignees=&labels=&template=bug_report.md&title=");
|
||||
registerLinkableButton(idea, "https://github.com/M4TH1EU/Flan-s-Mod-Updater/issues/new?assignees=&labels=&template=feature_request.md&title=");
|
||||
|
||||
packname.setEditable(false);
|
||||
convertir.setDisable(true);
|
||||
|
||||
convertir.setOnAction(event -> new Thread(() -> {
|
||||
try {
|
||||
Main.PACK_PATH = Files.createTempDirectory("flans-pack-old" + UUID.randomUUID()).toString() + "\\";
|
||||
Main.NEWPACK_PATH = Files.createTempDirectory("flans-pack-updated" + UUID.randomUUID()).toString() + "\\";
|
||||
Logger.info("Successfully set the new path to temps directories.");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Platform.runLater(() -> {
|
||||
selectpack.setDisable(true);
|
||||
convertir.setDisable(true);
|
||||
packname.setDisable(true);
|
||||
|
||||
convertir.setText("Extraction du pack...");
|
||||
ZipUtil.unpack(new File(Main.PACK_ZIP), new File(Main.PACK_PATH));
|
||||
});
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
Platform.runLater(() -> convertir.setText("Mise à jour..."));
|
||||
Main.convert();
|
||||
Platform.runLater(() -> convertir.setText("Terminé !"));
|
||||
} catch (Exception e) {
|
||||
Platform.runLater(() -> convertir.setText("Erreur, mise à jour échouée !"));
|
||||
}
|
||||
|
||||
Platform.runLater(() -> {
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setTitle("Information");
|
||||
alert.setHeaderText("Mise à jour terminée.");
|
||||
alert.setContentText("La mise à jour du pack " + packname.getText() + " est terminée !" + "\nChemin : " + selectedFile.getParent());
|
||||
|
||||
alert.showAndWait();
|
||||
});
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
FileUtils.deleteTempsFolder();
|
||||
|
||||
Platform.runLater(() -> {
|
||||
packname.setText("");
|
||||
selectedFile = new File("");
|
||||
convertir.setText("Mettre à jour mon pack");
|
||||
convertir.setDisable(false);
|
||||
packname.setDisable(false);
|
||||
selectpack.setDisable(false);
|
||||
});
|
||||
}).start());
|
||||
|
||||
selectpack.setOnAction(event -> {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Flans Pack", "*.zip", "*.jar", "*.rar"));
|
||||
selectedFile = fileChooser.showOpenDialog(Main.PRIMARY_STAGE);
|
||||
|
||||
if (selectedFile != null) {
|
||||
packname.setText(selectedFile.getName());
|
||||
Main.PACK_ZIP = selectedFile.getAbsolutePath();
|
||||
}
|
||||
convertir.setDisable(false);
|
||||
});
|
||||
}
|
||||
|
||||
public void registerHoverableButton(javafx.scene.control.Button button) {
|
||||
button.setOnMouseEntered(event -> {
|
||||
button.setStyle("-fx-background-color: grey; " +
|
||||
"-fx-border-color: grey;" +
|
||||
"-fx-text-fill: white;");
|
||||
});
|
||||
|
||||
button.setOnMouseExited(event -> {
|
||||
button.setStyle("-fx-background-color: transparent; " +
|
||||
"-fx-border-color: grey;");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void registerLinkableButton(javafx.scene.control.Button button, String url) {
|
||||
button.setOnAction(event -> {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,39 +1,43 @@
|
||||
package ch.m4th1eu.flansupdater;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Stage;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class Main {
|
||||
public static final String PACK_PATH = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack\\";
|
||||
public static final String NEWPACK_PATH = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack NEW\\";
|
||||
|
||||
public static final String VEHICLES_PATH = PACK_PATH + "vehicles\\";
|
||||
public static final String VEHICLES_NEWPATH = NEWPACK_PATH + "vehicles\\";
|
||||
|
||||
public static final String ARMOR_PATH = PACK_PATH + "armorFiles\\";
|
||||
public static final String ARMOR_NEWPATH = NEWPACK_PATH + "armorFiles\\";
|
||||
|
||||
public static final String ARMOR_TEXTURES_PATH = PACK_PATH + "assets\\flansmod\\armor\\";
|
||||
public static final String ARMOR_TEXTURES_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\armor\\";
|
||||
|
||||
public static final String VEHICLESSKINS_PATH = PACK_PATH + "assets\\flansmod\\skins\\";
|
||||
public static final String VEHICLESSKINS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\skins\\";
|
||||
|
||||
public static final String JSON_PATH = NEWPACK_PATH + "assets\\flansmod\\models\\item\\";
|
||||
|
||||
public static final String LANG_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\lang\\";
|
||||
|
||||
public static final String MODELS_PATH = PACK_PATH + "com\\";
|
||||
public static final String MODELS_NEWPATH = NEWPACK_PATH + "com\\";
|
||||
|
||||
public static final String ICONS_PATH = PACK_PATH + "assets\\flansmod\\textures\\items\\";
|
||||
public static final String ICONS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\textures\\items\\";
|
||||
|
||||
public class Main extends Application {
|
||||
private static final Main INSTANCE = new Main();
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static String PACK_ZIP = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack.zip";
|
||||
public static String PACK_PATH = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack\\";
|
||||
public static String VEHICLES_PATH = PACK_PATH + "vehicles\\";
|
||||
public static String ARMOR_PATH = PACK_PATH + "armorFiles\\";
|
||||
public static String ARMOR_TEXTURES_PATH = PACK_PATH + "assets\\flansmod\\armor\\";
|
||||
public static String VEHICLESSKINS_PATH = PACK_PATH + "assets\\flansmod\\skins\\";
|
||||
public static String MODELS_PATH = PACK_PATH + "com\\";
|
||||
public static String ICONS_PATH = PACK_PATH + "assets\\flansmod\\textures\\items\\";
|
||||
public static String NEWPACK_PATH = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack NEW\\";
|
||||
public static String VEHICLES_NEWPATH = NEWPACK_PATH + "vehicles\\";
|
||||
public static String ARMOR_NEWPATH = NEWPACK_PATH + "armorFiles\\";
|
||||
public static String ARMOR_TEXTURES_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\armor\\";
|
||||
public static String VEHICLESSKINS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\skins\\";
|
||||
public static String JSON_PATH = PACK_PATH + "assets\\flansmod\\models\\item\\";
|
||||
public static String JSON_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\models\\item\\";
|
||||
public static String LANG_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\lang\\";
|
||||
public static String MODELS_NEWPATH = NEWPACK_PATH + "com\\";
|
||||
public static String ICONS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\textures\\items\\";
|
||||
public static Stage PRIMARY_STAGE = null;
|
||||
|
||||
public static void convert() {
|
||||
Logger.info("Starting new pack update.");
|
||||
refreshVariables();
|
||||
|
||||
FileUtils.copyModels();
|
||||
VehiclesUtils.readAllVehiclesFiles();
|
||||
VehiclesUtils.readAllVehiclesSkins();
|
||||
@ -43,9 +47,43 @@ public class Main {
|
||||
FileUtils.createPackInfo();
|
||||
FileUtils.writeLangs(FileUtils.langs);
|
||||
|
||||
ZipUtil.pack(new File(NEWPACK_PATH), new File(Paths.get(NEWPACK_PATH).getParent() + "\\" + Paths.get(NEWPACK_PATH).getFileName() + ".zip"));
|
||||
ZipUtil.pack(new File(NEWPACK_PATH),
|
||||
new File(Paths.get(PACK_ZIP).getParent() + "\\" + Paths.get(PACK_ZIP).getFileName().toString().replaceAll(".zip", "")
|
||||
.replaceAll(".jar", "")
|
||||
.replaceAll(".rar", "")
|
||||
+ "_UPDATED.jar"));
|
||||
|
||||
Logger.info("Update complete.");
|
||||
}
|
||||
|
||||
private static void refreshVariables() {
|
||||
VEHICLES_PATH = PACK_PATH + "vehicles\\";
|
||||
ARMOR_PATH = PACK_PATH + "armorFiles\\";
|
||||
JSON_PATH = PACK_PATH + "assets\\flansmod\\models\\item\\";
|
||||
ARMOR_TEXTURES_PATH = PACK_PATH + "assets\\flansmod\\armor\\";
|
||||
VEHICLESSKINS_PATH = PACK_PATH + "assets\\flansmod\\skins\\";
|
||||
MODELS_PATH = PACK_PATH + "com\\";
|
||||
ICONS_PATH = PACK_PATH + "assets\\flansmod\\textures\\items\\";
|
||||
VEHICLES_NEWPATH = NEWPACK_PATH + "vehicles\\";
|
||||
ARMOR_NEWPATH = NEWPACK_PATH + "armorFiles\\";
|
||||
ARMOR_TEXTURES_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\armor\\";
|
||||
VEHICLESSKINS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\skins\\";
|
||||
JSON_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\models\\item\\";
|
||||
LANG_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\lang\\";
|
||||
MODELS_NEWPATH = NEWPACK_PATH + "com\\";
|
||||
ICONS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\textures\\items\\";
|
||||
Logger.info("Refreshed the variables.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
Parent root = FXMLLoader.load(Main.class.getResource("/menu.fxml"));
|
||||
|
||||
Main.PRIMARY_STAGE = primaryStage;
|
||||
Main.PRIMARY_STAGE.setTitle("Flans Updater");
|
||||
Main.PRIMARY_STAGE.setResizable(false);
|
||||
Main.PRIMARY_STAGE.setScene(new Scene(root, 625, 365));
|
||||
Main.PRIMARY_STAGE.getIcons().add(new Image(this.getClass().getResourceAsStream("/icon.png")));
|
||||
Main.PRIMARY_STAGE.show();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
package ch.m4th1eu.flansupdater;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -33,7 +32,7 @@ public class VehiclesUtils {
|
||||
}
|
||||
|
||||
try {
|
||||
FileWriter myWriter = new FileWriter(NEWFILENAME);
|
||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(NEWFILENAME), StandardCharsets.UTF_8);
|
||||
myWriter.write(processVehicleFile(readFile(path.toFile())));
|
||||
myWriter.close();
|
||||
} catch (IOException e) {
|
||||
|
BIN
src/main/resources/icon.png
Normal file
BIN
src/main/resources/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
src/main/resources/logo_transparent.png
Normal file
BIN
src/main/resources/logo_transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
43
src/main/resources/menu.fxml
Normal file
43
src/main/resources/menu.fxml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<AnchorPane style="-fx-background-color: #303030;" xmlns="http://javafx.com/javafx/8.0.171"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.m4th1eu.flansupdater.FrameController">
|
||||
<Label layoutX="414.0" layoutY="357.0" text="Flans Updater V2 - Développé par M4TH1EU_" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="11.0" fx:id="x3"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Button fx:id="bug" layoutX="182.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Signaler un bug"
|
||||
textFill="WHITE"/>
|
||||
|
||||
<Button fx:id="idea" layoutX="333.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Une idée ?" textFill="WHITE"/>
|
||||
|
||||
<Separator layoutY="347.0" prefHeight="16.0" prefWidth="640.0"/>
|
||||
|
||||
<Button fx:id="convertir" layoutX="197.0" layoutY="200.0" mnemonicParsing="false" prefHeight="48.0"
|
||||
prefWidth="252.0" style="-fx-background-color: transparent; -fx-border-color: white; -fx-border-width: 2;"
|
||||
text="Mettre à jour mon pack" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="20.0"/>
|
||||
</font>
|
||||
</Button>
|
||||
<Button fx:id="selectpack" layoutX="347.0" layoutY="147.0" mnemonicParsing="false" prefHeight="21.0"
|
||||
prefWidth="101.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Choisir un pack"
|
||||
textFill="WHITE"/>
|
||||
<TextField fx:id="packname" layoutX="196.0" layoutY="147.0" prefHeight="27.0" prefWidth="149.0"
|
||||
style="-fx-background-color: transparent; -fx-border-color: white; -fx-text-fill: white"/>
|
||||
<Label layoutX="197.0" layoutY="127.0" text="Nom du pack" textFill="WHITE"/>
|
||||
<ImageView fitHeight="118.0" fitWidth="583.0" layoutX="84.0" layoutY="-4.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@logo_transparent.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</AnchorPane>
|
76
src/main/resources/model.json
Normal file
76
src/main/resources/model.json
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "flansmod:items/your_item_texture"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
90,
|
||||
-35
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
1.25,
|
||||
-2.5
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
},
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
90,
|
||||
-35
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
1.25,
|
||||
-2.5
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
-45,
|
||||
25
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
4,
|
||||
2
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
-45,
|
||||
25
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
4,
|
||||
2
|
||||
],
|
||||
"scale": [
|
||||
0.80,
|
||||
0.80,
|
||||
0.80
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user