mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-03 15:08:29 +01:00
1.16+ support and remove unused imports in generated Block enum
This commit is contained in:
parent
290d922e3a
commit
c9589ae526
@ -3,11 +3,9 @@
|
||||
//==============================
|
||||
package net.minestom.server.instance.block;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
|
||||
import net.minestom.server.instance.block.states.*;
|
||||
@SuppressWarnings({"deprecation"})
|
||||
|
||||
|
@ -26,15 +26,19 @@ public class BlockEnumGenerator {
|
||||
public static final String BURGER_URL_BASE_URL = "https://pokechu22.github.io/Burger/";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
String targetVersion;
|
||||
if(args.length < 1) {
|
||||
System.err.println("Usage: <MC version> [target folder]");
|
||||
return;
|
||||
}
|
||||
|
||||
targetVersion = args[0];
|
||||
|
||||
try {
|
||||
ResourceGatherer.ensureResourcesArePresent(null); // TODO
|
||||
ResourceGatherer.ensureResourcesArePresent(targetVersion, null); // TODO
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String targetVersion = "1.15.2";
|
||||
if(args.length >= 1) {
|
||||
targetVersion = args[0];
|
||||
}
|
||||
|
||||
String targetPart = DEFAULT_TARGET_PATH;
|
||||
if(args.length >= 2) {
|
||||
@ -79,11 +83,9 @@ public class BlockEnumGenerator {
|
||||
EnumGenerator blockGenerator = new EnumGenerator(packageName, className);
|
||||
blockGenerator.addClassAnnotation("@SuppressWarnings({\"deprecation\"})");
|
||||
blockGenerator.addImport(NamespaceID.class.getCanonicalName());
|
||||
blockGenerator.addImport(BlockAlternative.class.getCanonicalName());
|
||||
blockGenerator.addImport(List.class.getCanonicalName());
|
||||
blockGenerator.addImport(ArrayList.class.getCanonicalName());
|
||||
blockGenerator.addImport(Arrays.class.getCanonicalName());
|
||||
blockGenerator.addImport(Short2ObjectOpenHashMap.class.getCanonicalName());
|
||||
blockGenerator.addImport(blockGenerator.getPackage()+".states.*");
|
||||
blockGenerator.addHardcodedField("List<BlockAlternative>", "alternatives", "new ArrayList<BlockAlternative>()");
|
||||
blockGenerator.setParams("String namespaceID", "short defaultID", "double hardness", "double resistance", "boolean isAir", "boolean isSolid", "NamespaceID blockEntity", "boolean singleState");
|
||||
|
@ -119,7 +119,7 @@ public class MinecraftServer {
|
||||
|
||||
// Registry
|
||||
try {
|
||||
ResourceGatherer.ensureResourcesArePresent(null); // TODO: provide a way to give a path override, probably via launch arguments?
|
||||
ResourceGatherer.ensureResourcesArePresent("1.15.2", null); // TODO: provide a way to give a path override, probably via launch arguments?
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("An error happened during resource gathering. Minestom will attempt to load anyway, but things may not work, and crashes can happen.", e);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class ResourceGatherer {
|
||||
* If it is not, download the minecraft server jar, run the data generator and extract the wanted files
|
||||
* If it is already present, directly return
|
||||
*/
|
||||
public static void ensureResourcesArePresent(File minecraftFolderOverride) throws IOException {
|
||||
public static void ensureResourcesArePresent(String version, File minecraftFolderOverride) throws IOException {
|
||||
if (DATA_FOLDER.exists()) {
|
||||
return;
|
||||
}
|
||||
@ -33,8 +33,6 @@ public class ResourceGatherer {
|
||||
throw new IOException("Failed to create tmp folder.");
|
||||
}
|
||||
|
||||
final String version = "1.15.2"; // TODO: Do not hardcode
|
||||
|
||||
LOGGER.info("Starting download of Minecraft server jar for version " + version + " from Mojang servers...");
|
||||
File minecraftFolder = getMinecraftFolder(minecraftFolderOverride);
|
||||
if (!minecraftFolder.exists()) {
|
||||
|
Loading…
Reference in New Issue
Block a user