mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 06:45:42 -04:00
Fix gradle file
This commit is contained in:
parent
33ef03ef71
commit
5a6e1ffcd9
@ -15,11 +15,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
*/
|
*/
|
||||||
plugins {
|
|
||||||
id "edu.sc.seis.macAppBundle" version "2.1.6"
|
|
||||||
//id "me.tatarka.retrolambda" version "3.5.0"
|
|
||||||
id 'edu.sc.seis.launch4j' version '2.3.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
@ -31,6 +26,12 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id "edu.sc.seis.macAppBundle" version "2.1.6"
|
||||||
|
//id "me.tatarka.retrolambda" version "3.5.0"
|
||||||
|
id 'edu.sc.seis.launch4j' version '2.3.0'
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'me.tatarka.retrolambda'
|
apply plugin: 'me.tatarka.retrolambda'
|
||||||
|
|
||||||
import java.util.jar.JarOutputStream
|
import java.util.jar.JarOutputStream
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher.
|
||||||
|
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* 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 {http://www.gnu.org/licenses/}.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hellominecraft.launcher.core.mod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author huang
|
||||||
|
*/
|
||||||
|
public interface ModAdviser {
|
||||||
|
|
||||||
|
ModSuggestion advise(String fileName, boolean isDirectory);
|
||||||
|
|
||||||
|
public static enum ModSuggestion {
|
||||||
|
SUGGESTED,
|
||||||
|
NORMAL,
|
||||||
|
HIDDEN
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -39,7 +39,6 @@ import org.jackhuang.hellominecraft.launcher.core.GameException;
|
|||||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftProvider;
|
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftProvider;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||||
import org.jackhuang.hellominecraft.util.func.BiFunction;
|
|
||||||
import org.jackhuang.hellominecraft.util.func.CallbackIO;
|
import org.jackhuang.hellominecraft.util.func.CallbackIO;
|
||||||
import org.jackhuang.hellominecraft.util.sys.CompressingUtils;
|
import org.jackhuang.hellominecraft.util.sys.CompressingUtils;
|
||||||
import org.jackhuang.hellominecraft.util.sys.FileUtils;
|
import org.jackhuang.hellominecraft.util.sys.FileUtils;
|
||||||
@ -73,14 +72,14 @@ public final class ModpackManager {
|
|||||||
/**
|
/**
|
||||||
* Install the compressed modpack.
|
* Install the compressed modpack.
|
||||||
*
|
*
|
||||||
* @param input modpack.zip
|
* @param input modpack.zip
|
||||||
* @param service MinecraftService, whose version service only supports
|
* @param service MinecraftService, whose version service only supports
|
||||||
* MinecraftVersionManager.
|
* MinecraftVersionManager.
|
||||||
* @param id new version id, if null, will use suggested name from
|
* @param id new version id, if null, will use suggested name from
|
||||||
* modpack
|
* modpack
|
||||||
*
|
*
|
||||||
* @return The installing Task, may take long time, please consider
|
* @return The installing Task, may take long time, please consider
|
||||||
* TaskWindow.
|
* TaskWindow.
|
||||||
*/
|
*/
|
||||||
public static Task install(JFrame parFrame, final File input, final IMinecraftService service, final String idFUCK) {
|
public static Task install(JFrame parFrame, final File input, final IMinecraftService service, final String idFUCK) {
|
||||||
return new Task() {
|
return new Task() {
|
||||||
@ -152,10 +151,10 @@ public final class ModpackManager {
|
|||||||
final AtomicInteger b = new AtomicInteger(0);
|
final AtomicInteger b = new AtomicInteger(0);
|
||||||
HMCLog.log("Decompressing modpack");
|
HMCLog.log("Decompressing modpack");
|
||||||
CompressingUtils.unzip(input, versions, t -> {
|
CompressingUtils.unzip(input, versions, t -> {
|
||||||
if (t.equals("minecraft/pack.json"))
|
if (t.equals("minecraft/pack.json"))
|
||||||
b.incrementAndGet();
|
b.incrementAndGet();
|
||||||
return true;
|
return true;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
// No pack.json here, illegal modpack.
|
// No pack.json here, illegal modpack.
|
||||||
if (b.get() < 1)
|
if (b.get() < 1)
|
||||||
@ -208,40 +207,31 @@ public final class ModpackManager {
|
|||||||
public static final List<String> MODPACK_BLACK_LIST = Arrays.asList(new String[] { "usernamecache.json", "asm", "logs", "backups", "versions", "assets", "usercache.json", "libraries", "crash-reports", "launcher_profiles.json", "NVIDIA", "AMD", "TCNodeTracker", "screenshots", "natives", "native", "$native", "pack.json", "launcher.jar", "minetweaker.log", "launcher.pack.lzma", "hmclmc.log" });
|
public static final List<String> MODPACK_BLACK_LIST = Arrays.asList(new String[] { "usernamecache.json", "asm", "logs", "backups", "versions", "assets", "usercache.json", "libraries", "crash-reports", "launcher_profiles.json", "NVIDIA", "AMD", "TCNodeTracker", "screenshots", "natives", "native", "$native", "pack.json", "launcher.jar", "minetweaker.log", "launcher.pack.lzma", "hmclmc.log" });
|
||||||
public static final List<String> MODPACK_SUGGESTED_BLACK_LIST = Arrays.asList(new String[] { "fonts", "saves", "servers.dat", "options.txt", "optionsof.txt", "journeymap", "optionsshaders.txt", "mods/VoxelMods" });
|
public static final List<String> MODPACK_SUGGESTED_BLACK_LIST = Arrays.asList(new String[] { "fonts", "saves", "servers.dat", "options.txt", "optionsof.txt", "journeymap", "optionsshaders.txt", "mods/VoxelMods" });
|
||||||
|
|
||||||
/**
|
public static ModAdviser MODPACK_PREDICATE = (String fileName, boolean isDirectory) -> {
|
||||||
* < String, Boolean, Boolean >: Folder/File name, Is Directory,
|
if (match(MODPACK_BLACK_LIST, fileName, isDirectory))
|
||||||
* Return 0: non blocked, 1: non shown, 2: suggested, checked.
|
return ModAdviser.ModSuggestion.HIDDEN;
|
||||||
*/
|
if (match(MODPACK_SUGGESTED_BLACK_LIST, fileName, isDirectory))
|
||||||
public static final BiFunction<String, Boolean, Integer> MODPACK_PREDICATE = (String x, Boolean y) -> {
|
return ModAdviser.ModSuggestion.NORMAL;
|
||||||
if (ModpackManager.MODPACK_BLACK_LIST_PREDICATE.apply(x, y))
|
return ModAdviser.ModSuggestion.SUGGESTED;
|
||||||
return 1;
|
|
||||||
if (ModpackManager.MODPACK_SUGGESTED_BLACK_LIST_PREDICATE.apply(x, y))
|
|
||||||
return 2;
|
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final BiFunction<String, Boolean, Boolean> MODPACK_BLACK_LIST_PREDICATE = modpackPredicateMaker(MODPACK_BLACK_LIST);
|
private static boolean match(final List<String> l, String fileName, boolean isDirectory) {
|
||||||
public static final BiFunction<String, Boolean, Boolean> MODPACK_SUGGESTED_BLACK_LIST_PREDICATE = modpackPredicateMaker(MODPACK_SUGGESTED_BLACK_LIST);
|
for (String s : l)
|
||||||
|
if (isDirectory) {
|
||||||
private static BiFunction<String, Boolean, Boolean> modpackPredicateMaker(final List<String> l) {
|
if (fileName.startsWith(s + "/"))
|
||||||
return (String x, Boolean y) -> {
|
|
||||||
for (String s : l)
|
|
||||||
if (y) {
|
|
||||||
if (x.startsWith(s + "/"))
|
|
||||||
return true;
|
|
||||||
} else if (x.equals(s))
|
|
||||||
return true;
|
return true;
|
||||||
return false;
|
} else if (fileName.equals(s))
|
||||||
};
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export the game to a mod pack file.
|
* Export the game to a mod pack file.
|
||||||
*
|
*
|
||||||
* @param output mod pack file.
|
* @param output mod pack file.
|
||||||
* @param baseFolder if the game dir type is ROOT_FOLDER, use ".minecraft",
|
* @param baseFolder if the game dir type is ROOT_FOLDER, use ".minecraft",
|
||||||
* or use ".minecraft/versions/{MCVER}/"
|
* or use ".minecraft/versions/{MCVER}/"
|
||||||
* @param version to locate version.json
|
* @param version to locate version.json
|
||||||
*
|
*
|
||||||
* @throws IOException if create tmp directory failed
|
* @throws IOException if create tmp directory failed
|
||||||
*/
|
*/
|
||||||
@ -256,14 +246,14 @@ public final class ModpackManager {
|
|||||||
try {
|
try {
|
||||||
zip = new ZipEngine(output);
|
zip = new ZipEngine(output);
|
||||||
zip.putDirectory(provider.getRunDirectory(version), (String x, Boolean y) -> {
|
zip.putDirectory(provider.getRunDirectory(version), (String x, Boolean y) -> {
|
||||||
for (String s : b)
|
for (String s : b)
|
||||||
if (y) {
|
if (y) {
|
||||||
if (x.startsWith(s + "/"))
|
if (x.startsWith(s + "/"))
|
||||||
return null;
|
return null;
|
||||||
} else if (x.equals(s))
|
} else if (x.equals(s))
|
||||||
return null;
|
return null;
|
||||||
return "minecraft/" + x;
|
return "minecraft/" + x;
|
||||||
});
|
});
|
||||||
|
|
||||||
MinecraftVersion mv = provider.getVersionById(version).resolve(provider);
|
MinecraftVersion mv = provider.getVersionById(version).resolve(provider);
|
||||||
MinecraftVersionRequest r = MinecraftVersionRequest.minecraftVersion(provider.getMinecraftJar(version));
|
MinecraftVersionRequest r = MinecraftVersionRequest.minecraftVersion(provider.getMinecraftJar(version));
|
||||||
|
@ -103,7 +103,6 @@ public final class Main implements Runnable {
|
|||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
|
||||||
|
|
||||||
@SuppressWarnings({ "CallToPrintStackTrace", "UseSpecificCatch" })
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
{
|
{
|
||||||
PluginManager.getPlugin(DefaultPlugin.class);
|
PluginManager.getPlugin(DefaultPlugin.class);
|
||||||
|
@ -32,7 +32,6 @@ public class DraggableFrame extends JFrame
|
|||||||
private int dragGripX;
|
private int dragGripX;
|
||||||
private int dragGripY;
|
private int dragGripY;
|
||||||
|
|
||||||
@SuppressWarnings("LeakingThisInConstructor")
|
|
||||||
public DraggableFrame() {
|
public DraggableFrame() {
|
||||||
addMouseListener(this);
|
addMouseListener(this);
|
||||||
addMouseMotionListener(this);
|
addMouseMotionListener(this);
|
||||||
|
@ -23,9 +23,9 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.swing.tree.DefaultTreeModel;
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
|
import org.jackhuang.hellominecraft.launcher.core.mod.ModAdviser;
|
||||||
import org.jackhuang.hellominecraft.util.C;
|
import org.jackhuang.hellominecraft.util.C;
|
||||||
import org.jackhuang.hellominecraft.util.Pair;
|
import org.jackhuang.hellominecraft.util.Pair;
|
||||||
import org.jackhuang.hellominecraft.util.func.BiFunction;
|
|
||||||
import org.jackhuang.hellominecraft.util.sys.FileUtils;
|
import org.jackhuang.hellominecraft.util.sys.FileUtils;
|
||||||
import org.jackhuang.hellominecraft.util.ui.checktree.CheckBoxTreeCellRenderer;
|
import org.jackhuang.hellominecraft.util.ui.checktree.CheckBoxTreeCellRenderer;
|
||||||
import org.jackhuang.hellominecraft.util.ui.checktree.CheckBoxTreeNode;
|
import org.jackhuang.hellominecraft.util.ui.checktree.CheckBoxTreeNode;
|
||||||
@ -40,7 +40,7 @@ public class ModpackFileSelectionPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private transient final WizardController controller;
|
private transient final WizardController controller;
|
||||||
private final Map wizardData;
|
private final Map wizardData;
|
||||||
private transient final BiFunction<String, Boolean, Integer> blackList;
|
private transient final ModAdviser blackList;
|
||||||
private final Set<String> bannedFiles = new HashSet<>();
|
private final Set<String> bannedFiles = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,7 @@ public class ModpackFileSelectionPanel extends javax.swing.JPanel {
|
|||||||
* @param blackList Return 0: non blocked, 1: non shown, 2: suggested,
|
* @param blackList Return 0: non blocked, 1: non shown, 2: suggested,
|
||||||
* checked
|
* checked
|
||||||
*/
|
*/
|
||||||
public ModpackFileSelectionPanel(WizardController controller, Map wizardData, File gameDir, BiFunction<String, Boolean, Integer> blackList) {
|
public ModpackFileSelectionPanel(WizardController controller, Map wizardData, File gameDir, ModAdviser blackList) {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
@ -83,12 +83,12 @@ public class ModpackFileSelectionPanel extends javax.swing.JPanel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CheckBoxTreeNode create(File file, String basePath) {
|
CheckBoxTreeNode create(File file, String basePath) {
|
||||||
int state = 0;
|
ModAdviser.ModSuggestion state = ModAdviser.ModSuggestion.NORMAL;
|
||||||
if (basePath.length() > "minecraft/".length())
|
if (basePath.length() > "minecraft/".length())
|
||||||
if ((state = blackList.apply(basePath.substring("minecraft/".length()) + (file.isDirectory() ? "/" : ""), file.isDirectory())) == 1)
|
if ((state = blackList.advise(basePath.substring("minecraft/".length()) + (file.isDirectory() ? "/" : ""), file.isDirectory())) == ModAdviser.ModSuggestion.HIDDEN)
|
||||||
return null;
|
return null;
|
||||||
CheckBoxTreeNode node = new CheckBoxTreeNode(TRANSLATION.containsKey(basePath) ? new Pair<>(FileUtils.getName(basePath), TRANSLATION.get(basePath)) : FileUtils.getName(basePath));
|
CheckBoxTreeNode node = new CheckBoxTreeNode(TRANSLATION.containsKey(basePath) ? new Pair<>(FileUtils.getName(basePath), TRANSLATION.get(basePath)) : FileUtils.getName(basePath));
|
||||||
if (state == 2)
|
if (state == ModAdviser.ModSuggestion.SUGGESTED)
|
||||||
node.setSelected(true);
|
node.setSelected(true);
|
||||||
|
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
|
@ -3528,7 +3528,6 @@ public final class MainWindow extends javax.swing.JFrame
|
|||||||
Server.getInstance().sendCommand("save-all");
|
Server.getInstance().sendCommand("save-all");
|
||||||
}//GEN-LAST:event_btnSaveActionPerformed
|
}//GEN-LAST:event_btnSaveActionPerformed
|
||||||
|
|
||||||
@SuppressWarnings("UseOfObsoleteCollectionType")
|
|
||||||
private void btnSaveExtModActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveExtModActionPerformed
|
private void btnSaveExtModActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveExtModActionPerformed
|
||||||
ArrayList<String> arrayList = new ArrayList<>();
|
ArrayList<String> arrayList = new ArrayList<>();
|
||||||
Vector strings = ((DefaultTableModel) lstExternalMods.getModel()).getDataVector();
|
Vector strings = ((DefaultTableModel) lstExternalMods.getModel()).getDataVector();
|
||||||
@ -3541,7 +3540,6 @@ public final class MainWindow extends javax.swing.JFrame
|
|||||||
SettingsManager.save();
|
SettingsManager.save();
|
||||||
}//GEN-LAST:event_btnSaveExtModActionPerformed
|
}//GEN-LAST:event_btnSaveExtModActionPerformed
|
||||||
|
|
||||||
@SuppressWarnings("UseOfObsoleteCollectionType")
|
|
||||||
private void btnSavePluginsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePluginsActionPerformed
|
private void btnSavePluginsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePluginsActionPerformed
|
||||||
ArrayList<String> arrayList = new ArrayList<>();
|
ArrayList<String> arrayList = new ArrayList<>();
|
||||||
Vector strings = ((DefaultTableModel) lstCoreMods.getModel()).getDataVector();
|
Vector strings = ((DefaultTableModel) lstCoreMods.getModel()).getDataVector();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Hello Minecraft!.
|
* Hello Minecraft!.
|
||||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -22,6 +22,6 @@ package org.jackhuang.hellominecraft.util.func;
|
|||||||
* @author huangyuhui
|
* @author huangyuhui
|
||||||
*/
|
*/
|
||||||
public interface BiFunction<A, B, C> {
|
public interface BiFunction<A, B, C> {
|
||||||
|
|
||||||
C apply(A a, B b);
|
C apply(A a, B b);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ package org.jackhuang.hellominecraft.util.sys;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import org.jackhuang.hellominecraft.util.CollectionUtils;
|
import org.jackhuang.hellominecraft.util.CollectionUtils;
|
||||||
import org.jackhuang.hellominecraft.api.EventHandler;
|
|
||||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||||
import org.jackhuang.hellominecraft.api.event.process.JVMLaunchFailedEvent;
|
import org.jackhuang.hellominecraft.api.event.process.JVMLaunchFailedEvent;
|
||||||
import org.jackhuang.hellominecraft.api.event.process.JavaProcessExitedAbnormallyEvent;
|
import org.jackhuang.hellominecraft.api.event.process.JavaProcessExitedAbnormallyEvent;
|
||||||
@ -57,7 +56,6 @@ public class JavaProcessMonitor {
|
|||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
HMCAPI.EVENT_BUS.fireChannel(new JavaProcessStartingEvent(this, p));
|
HMCAPI.EVENT_BUS.fireChannel(new JavaProcessStartingEvent(this, p));
|
||||||
ProcessThread a = new ProcessThread(p);
|
ProcessThread a = new ProcessThread(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user