This commit is contained in:
parent
29f76f0881
commit
c1e0737d70
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
**1.0.2**
|
||||
* Improve Errors
|
||||
* Improve GUI
|
||||
|
||||
**1.0.1**
|
||||
* New Icon
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
# ModUpdater
|
||||
A simple Minecraft mod updater.
|
||||
|
||||
**NOTE:** This is only able to scan mods that have opted-in!
|
||||
|
||||
## Mod Users
|
||||
Go to the Mod Menu and click the configure icon for ModUpdater.
|
||||
|
||||
|
@ -9,7 +9,7 @@ org.gradle.jvmargs = -Xmx1G
|
||||
fabric_loader_version = 0.8.8+build.202
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.1
|
||||
mod_version = 1.0.2
|
||||
maven_group = com.thebrokenrail
|
||||
|
||||
# Dependencies
|
||||
|
@ -11,7 +11,7 @@ public class ModUpdater implements ModInitializer {
|
||||
|
||||
private static final String LOGGER_NAME = "ModUpdater";
|
||||
|
||||
private static Logger getLogger() {
|
||||
public static Logger getLogger() {
|
||||
return LogManager.getLogger(LOGGER_NAME);
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,13 @@ public class ModUpdateScreen extends Screen {
|
||||
int paddingX = 5;
|
||||
int doneX = width / 2 - buttonWidth - paddingX;
|
||||
int downloadX = width / 2 + paddingX;
|
||||
download = addButton(new ButtonWidget(downloadX, height - 38, buttonWidth, 20, new TranslatableText("gui." + ModUpdater.NAMESPACE + ".download"), buttonWidget -> {
|
||||
download = addButton(new ButtonWidget(downloadX, height - 30, buttonWidth, 20, new TranslatableText("gui." + ModUpdater.NAMESPACE + ".download"), buttonWidget -> {
|
||||
if (list.getSelected() != null) {
|
||||
Util.getOperatingSystem().open(list.getSelected().update.downloadURL);
|
||||
}
|
||||
}));
|
||||
download.active = false;
|
||||
addButton(new ButtonWidget(doneX, height - 38, buttonWidth, 20, ScreenTexts.DONE, buttonWidget -> {
|
||||
addButton(new ButtonWidget(doneX, height - 30, buttonWidth, 20, ScreenTexts.DONE, buttonWidget -> {
|
||||
assert client != null;
|
||||
client.openScreen(parent);
|
||||
}));
|
||||
@ -58,7 +58,7 @@ public class ModUpdateScreen extends Screen {
|
||||
private final ModUpdateScreen screen;
|
||||
|
||||
private ModUpdateListWidget(MinecraftClient client, ModUpdateScreen screen) {
|
||||
super(client, screen.width, screen.height, 32, screen.height - 65 + 4, 18);
|
||||
super(client, screen.width, screen.height, 32, screen.height - 40, 18);
|
||||
this.screen = screen;
|
||||
|
||||
for (ModUpdate update : ModUpdater.getUpdates()) {
|
||||
@ -68,12 +68,12 @@ public class ModUpdateScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public int getRowWidth() {
|
||||
return width - 20;
|
||||
return width - 40;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrollbarPositionX() {
|
||||
return super.getScrollbarPositionX() + 30;
|
||||
return width - 14;
|
||||
}
|
||||
|
||||
private int getWidth() {
|
||||
@ -116,7 +116,8 @@ public class ModUpdateScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
screen.textRenderer.drawWithShadow(matrices, update.text, (float) (parent.getWidth() / 2 - screen.textRenderer.getWidth(update.text) / 2), (float) (y + 1), 16777215, true);
|
||||
String text = screen.textRenderer.trimToWidth(update.text, parent.getRowWidth() - 6);
|
||||
screen.textRenderer.drawWithShadow(matrices, text, (float) (parent.getWidth() / 2 - screen.textRenderer.getWidth(text) / 2), (float) (y + 3), 16777215, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ class CurseForgeStrategy implements ModUpdateStrategy {
|
||||
try {
|
||||
files = jsonAdapter.fromJson(data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
ModUpdater.getLogger().warn("Unable To Access CurseForge: " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class MavenStrategy implements ModUpdateStrategy {
|
||||
SAXReader reader = new SAXReader();
|
||||
doc = reader.read(new URL(mavenRoot + "/maven-metadata.xml"));
|
||||
} catch (MalformedURLException | DocumentException e) {
|
||||
ModUpdater.invalidModUpdaterConfig(name);
|
||||
ModUpdater.getLogger().warn("Unable To Access Maven Repository: " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -5,15 +5,24 @@ import java.util.Map;
|
||||
|
||||
public class HardcodedData {
|
||||
public static ConfigObject getData(String modID) {
|
||||
if ("fabric".equals(modID)) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("strategy", "maven");
|
||||
map.put("repository", "https://maven.fabricmc.net");
|
||||
map.put("group", "net.fabricmc.fabric-api");
|
||||
map.put("artifact", "fabric-api");
|
||||
return new ConfigObject.ConfigObjectHardcoded(map);
|
||||
} else {
|
||||
return null;
|
||||
switch (modID) {
|
||||
case "fabric": {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("strategy", "maven");
|
||||
map.put("repository", "https://maven.fabricmc.net");
|
||||
map.put("group", "net.fabricmc.fabric-api");
|
||||
map.put("artifact", "fabric-api");
|
||||
return new ConfigObject.ConfigObjectHardcoded(map);
|
||||
}
|
||||
case "modmenu": {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("strategy", "curseforge");
|
||||
map.put("projectID", 308702);
|
||||
return new ConfigObject.ConfigObjectHardcoded(map);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user