aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-07-22 18:35:51 +0200
committernea <romangraef@gmail.com>2022-07-23 14:52:00 +0200
commit26432327f95cc08c81145629ceea45e782755819 (patch)
tree330b0ebc4022cfd41cb570452fa48d6e2832b07b
parent804aa19a01737413afd738b95e1d8d0e7740fb80 (diff)
downloadNotEnoughUpdates-26432327f95cc08c81145629ceea45e782755819.tar.gz
NotEnoughUpdates-26432327f95cc08c81145629ceea45e782755819.tar.bz2
NotEnoughUpdates-26432327f95cc08c81145629ceea45e782755819.zip
stuff, also openGui in recipes
-rw-r--r--build.gradle.kts3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/UpdateLoader.java20
3 files changed, 24 insertions, 9 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 54c9e92f..3a2eb76c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -92,6 +92,7 @@ repositories {
mavenCentral()
mavenLocal()
maven("https://repo.spongepowered.org/maven/")
+ maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
maven("https://jitpack.io")
}
@@ -107,6 +108,8 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testAnnotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")
// modImplementation("io.github.notenoughupdates:MoulConfig:0.0.1")
+
+ modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index cd0d08b5..fddb56d6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -672,7 +672,8 @@ public class NEUManager {
ea = ea.getCompoundTag("Properties");
ea = ea.getTagList("textures", 10).getCompoundTagAt(0);
String name = ea3.getString("Name").replaceAll(" M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$", "");
- return "put(\"ID\", Utils.createSkull(EnumChatFormatting.AQUA + \"" + name + "\" ,\"" + ea2.getString("Id") + "\", \"" + ea.getString("Value") +"\"));";
+ return "put(\"ID\", Utils.createSkull(EnumChatFormatting.AQUA + \"" + name + "\" ,\"" + ea2.getString("Id") +
+ "\", \"" + ea.getString("Value") + "\"));";
}
}
return null;
@@ -912,6 +913,7 @@ public class NEUManager {
NBTTagCompound tag = stack.getTagCompound();
return getSkullValueFromNBT(tag);
}
+
public String getInternalNameForItem(ItemStack stack) {
if (stack == null) return null;
NBTTagCompound tag = stack.getTagCompound();
@@ -948,8 +950,7 @@ public class NEUManager {
if (!usagesMap.containsKey(internalName)) return false;
List<NeuRecipe> usages = getAvailableUsagesFor(internalName);
if (usages.isEmpty()) return false;
- Minecraft.getMinecraft().displayGuiScreen(
- new GuiItemRecipe(usages, this));
+ NotEnoughUpdates.INSTANCE.openGui = (new GuiItemRecipe(usages, this));
return true;
}
@@ -957,8 +958,7 @@ public class NEUManager {
if (!recipesMap.containsKey(internalName)) return false;
List<NeuRecipe> recipes = getAvailableRecipesFor(internalName);
if (recipes.isEmpty()) return false;
- Minecraft.getMinecraft().displayGuiScreen(
- new GuiItemRecipe(recipes, this));
+ NotEnoughUpdates.INSTANCE.openGui = (new GuiItemRecipe(recipes, this));
return true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/UpdateLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/UpdateLoader.java
index 8d301af7..d358533e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/UpdateLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/UpdateLoader.java
@@ -19,13 +19,16 @@
package io.github.moulberry.notenoughupdates.miscfeatures.updater;
-import com.google.common.io.Files;
import io.github.moulberry.notenoughupdates.util.NetUtils;
import net.minecraft.client.Minecraft;
+import org.apache.commons.io.IOUtils;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -98,7 +101,13 @@ abstract class UpdateLoader {
return;
}
ArrayList<File> toDelete = new ArrayList<>();
- for (File sus : mcDataDir.listFiles()) {
+ File[] modFiles = mcDataDir.listFiles();
+ if (modFiles == null) {
+ updater.logProgress("§cCould not list minecraft mod folder (" + mcDataDir + ")");
+ state = State.FAILED;
+ return;
+ }
+ for (File sus : modFiles) {
if (sus.getName().endsWith(".jar")) {
if (updater.isNeuJar(sus)) {
updater.logProgress("Found old NEU file: " + sus + ". Deleting later.");
@@ -107,8 +116,11 @@ abstract class UpdateLoader {
}
}
File dest = new File(mcDataDir, file.getName());
- try {
- Files.copy(file, dest);
+ try (
+ InputStream i = Files.newInputStream(file.toPath());
+ OutputStream o = Files.newOutputStream(dest.toPath());
+ ) {
+ IOUtils.copyLarge(i, o);
} catch (IOException e) {
e.printStackTrace();
updater.logProgress(