mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
Copy assets folder, item mapping (1.7.10 - 1.15.2)
This commit is contained in:
parent
a2ca7646d0
commit
76e17e0a24
@ -22,6 +22,7 @@ import de.bixilon.minosoft.logging.LogLevel;
|
||||
import de.bixilon.minosoft.mojang.api.MojangAccount;
|
||||
import de.bixilon.minosoft.protocol.network.Connection;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.FolderUtil;
|
||||
import de.bixilon.minosoft.util.OSUtil;
|
||||
import de.bixilon.minosoft.util.Util;
|
||||
import org.json.JSONException;
|
||||
@ -54,6 +55,9 @@ public class Minosoft {
|
||||
// set log level from config
|
||||
Log.setLevel(LogLevel.byName(config.getString(GameConfiguration.GENERAL_LOG_LEVEL)));
|
||||
Log.info(String.format("Logging info with level: %s", Log.getLevel().name()));
|
||||
Log.info("Checking assets...");
|
||||
checkAssets();
|
||||
Log.info("Assets checking done");
|
||||
Log.info("Loading all mappings...");
|
||||
loadMappings();
|
||||
Log.info("Mappings loaded");
|
||||
@ -142,4 +146,14 @@ public class Minosoft {
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkAssets() {
|
||||
try {
|
||||
FolderUtil.copyFolder(Minosoft.class.getResource("/assets").toURI(), Config.homeDir + "assets/");
|
||||
} catch (Exception e) {
|
||||
Log.fatal("Error occurred while checking assets: " + e.getLocalizedMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -201,6 +201,11 @@ public class TextComponent {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getColoredMessage();
|
||||
}
|
||||
|
||||
public enum ChatAttributes {
|
||||
BLACK("\033[38;2;0;0;0m", ChatColor.BLACK),
|
||||
DARK_BLUE("\033[38;2;0;0;170m", ChatColor.DARK_BLUE),
|
||||
|
@ -61,7 +61,7 @@ public class PacketScoreboardObjective implements ClientboundPacket {
|
||||
|
||||
@Override
|
||||
public void log() {
|
||||
Log.protocol(String.format("Received scoreboard objective action (action=%s, name=\"%s\", value=\"%s\"", action.name(), name, value));
|
||||
Log.protocol(String.format("Received scoreboard objective action (action=%s, name=\"%s\", value=\"%s\"", action.name(), name, value.getColoredMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
44
src/main/java/de/bixilon/minosoft/util/FolderUtil.java
Normal file
44
src/main/java/de/bixilon/minosoft/util/FolderUtil.java
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Codename Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class FolderUtil {
|
||||
|
||||
public static void copyFolder(URI from, String to) throws IOException {
|
||||
File folder = new File(from);
|
||||
for (String entry : folder.list()) {
|
||||
File entryFile = new File(folder.getPath() + File.separator + entry);
|
||||
if (entryFile.isDirectory()) {
|
||||
copyFolder(entryFile.toURI(), to + File.separator + entry);
|
||||
continue;
|
||||
}
|
||||
File out = new File(to + File.separator + entry);
|
||||
if (out.exists()) {
|
||||
continue;
|
||||
}
|
||||
File outFolder = new File(out.getParent());
|
||||
if (!outFolder.exists()) {
|
||||
outFolder.mkdirs();
|
||||
}
|
||||
Files.copy(new FileInputStream(entryFile), out.toPath());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2383
src/main/resources/assets/mapping/1.12.2/items.json
Normal file
2383
src/main/resources/assets/mapping/1.12.2/items.json
Normal file
File diff suppressed because it is too large
Load Diff
2372
src/main/resources/assets/mapping/1.13.2/items.json
Normal file
2372
src/main/resources/assets/mapping/1.13.2/items.json
Normal file
File diff suppressed because it is too large
Load Diff
9898
src/main/resources/assets/mapping/1.14.4/registries.json
Normal file
9898
src/main/resources/assets/mapping/1.14.4/registries.json
Normal file
File diff suppressed because it is too large
Load Diff
9999
src/main/resources/assets/mapping/1.15.2/registries.json
Normal file
9999
src/main/resources/assets/mapping/1.15.2/registries.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user