1
0
mirror of https://github.com/chylex/Minecraft-Window-Title.git synced 2024-11-25 23:42:45 +01:00

Compare commits

..

No commits in common. "02d6f2a63d666b1c39a3f4147777775e021ee593" and "5325cdf2823a8776bdcfa00e759dcb1532c8f1a2" have entirely different histories.

3 changed files with 20 additions and 12 deletions

View File

@ -11,7 +11,7 @@ public class CustomWindowTitle implements ClientModInitializer {
private final TitleConfig config; private final TitleConfig config;
public CustomWindowTitle() { public CustomWindowTitle() {
config = TitleConfig.read(FabricLoader.getInstance().getConfigDir().toAbsolutePath().toString()); config = TitleConfig.read(FabricLoader.getInstance().getConfigDirectory().getAbsolutePath());
} }
@Override @Override

View File

@ -3,22 +3,22 @@ modId=customwindowtitle
modName=Custom Window Title modName=Custom Window Title
modDescription=Customize window title and icon. modDescription=Customize window title and icon.
modAuthor=chylex modAuthor=chylex
modVersion=1.1.2 modVersion=1.1.1
modLicense=Unlicense modLicense=Unlicense
modSourcesURL=https://github.com/chylex/Minecraft-Window-Title modSourcesURL=https://github.com/chylex/Minecraft-Window-Title
modIssuesURL=https://github.com/chylex/Minecraft-Window-Title/issues modIssuesURL=https://github.com/chylex/Minecraft-Window-Title/issues
# Dependencies # Dependencies
minecraftVersion=1.19.3 minecraftVersion=1.19
forgeVersion=44.1.0 forgeVersion=41.1.0
fabricVersion=0.14.12 fabricVersion=0.14.12
loomVersion=0.12 loomVersion=0.12
mixinVersion=0.8.5 mixinVersion=0.8.5
# Constraints # Constraints
minimumMinecraftVersion=1.19.3 minimumMinecraftVersion=1.19
minimumForgeVersion=44.0.0 minimumForgeVersion=41.0.1
minimumFabricVersion=0.12.3 minimumFabricVersion=0.12.0
# Gradle # Gradle
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G

View File

@ -1,11 +1,11 @@
package chylex.customwindowtitle; package chylex.customwindowtitle;
import net.minecraft.server.packs.resources.IoSupplier;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@ -113,11 +113,19 @@ public final class TitleConfig {
return icon16 != null && icon32 != null; return icon16 != null && icon32 != null;
} }
public IoSupplier<InputStream> readIcon16() { public InputStream readIcon16() {
return IoSupplier.create(icon16); try {
return Files.newInputStream(icon16, StandardOpenOption.READ);
} catch (final IOException e) {
throw new RuntimeException("CustomWindowTitle could not open the specified 16x16 icon: " + icon16, e);
}
} }
public IoSupplier<InputStream> readIcon32() { public InputStream readIcon32() {
return IoSupplier.create(icon32); try {
return Files.newInputStream(icon32, StandardOpenOption.READ);
} catch (final IOException e) {
throw new RuntimeException("CustomWindowTitle could not open the specified 32x32 icon: " + icon16, e);
}
} }
} }