Copy assets folder, item mapping (1.7.10 - 1.15.2)

This commit is contained in:
Bixilon 2020-07-12 13:53:28 +02:00
parent a2ca7646d0
commit 76e17e0a24
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
8 changed files with 24716 additions and 1 deletions

View File

@ -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);
}
}
}

View File

@ -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),

View File

@ -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

View 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());
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff