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

Compare commits

...

3 Commits

7 changed files with 19 additions and 28 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().getConfigDirectory().getAbsolutePath()); config = TitleConfig.read(FabricLoader.getInstance().getConfigDir().toAbsolutePath().toString());
} }
@Override @Override

View File

@ -11,7 +11,6 @@ import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
@Mod("customwindowtitle") @Mod("customwindowtitle")
public class CustomWindowTitle { public class CustomWindowTitle {
@ -19,7 +18,7 @@ public class CustomWindowTitle {
public CustomWindowTitle() { public CustomWindowTitle() {
config = TitleConfig.read(FMLPaths.CONFIGDIR.get().toString()); config = TitleConfig.read(FMLPaths.CONFIGDIR.get().toString());
ModLoadingContext.get().registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true)); ModLoadingContext.get().registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> DisplayTest.IGNORESERVERONLY, (a, b) -> true));
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
CommonTokenData.register(new TokenProvider()); CommonTokenData.register(new TokenProvider());
} }

View File

@ -78,12 +78,12 @@ allprojects {
} }
extensions.getByType<JavaPluginExtension>().apply { extensions.getByType<JavaPluginExtension>().apply {
toolchain.languageVersion.set(JavaLanguageVersion.of(16)) toolchain.languageVersion.set(JavaLanguageVersion.of(17))
} }
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = "UTF-8" options.encoding = "UTF-8"
options.release.set(16) options.release.set(17)
} }
} }

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.1 modVersion=1.1.2
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.17.1 minecraftVersion=1.19.3
forgeVersion=37.0.75 forgeVersion=44.1.0
fabricVersion=0.11.7 fabricVersion=0.14.12
loomVersion=0.12 loomVersion=0.12
mixinVersion=0.8.4 mixinVersion=0.8.5
# Constraints # Constraints
minimumMinecraftVersion=1.17 minimumMinecraftVersion=1.19.3
minimumForgeVersion=31.2.45 minimumForgeVersion=44.0.0
minimumFabricVersion=0.7.2 minimumFabricVersion=0.12.3
# 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,19 +113,11 @@ public final class TitleConfig {
return icon16 != null && icon32 != null; return icon16 != null && icon32 != null;
} }
public InputStream readIcon16() { public IoSupplier<InputStream> readIcon16() {
try { return IoSupplier.create(icon16);
return Files.newInputStream(icon16, StandardOpenOption.READ);
} catch (final IOException e) {
throw new RuntimeException("CustomWindowTitle could not open the specified 16x16 icon: " + icon16, e);
}
} }
public InputStream readIcon32() { public IoSupplier<InputStream> readIcon32() {
try { return IoSupplier.create(icon32);
return Files.newInputStream(icon32, StandardOpenOption.READ);
} catch (final IOException e) {
throw new RuntimeException("CustomWindowTitle could not open the specified 32x32 icon: " + icon16, e);
}
} }
} }

View File

@ -3,7 +3,7 @@
"minVersion": "0.8", "minVersion": "0.8",
"package": "chylex.customwindowtitle.mixin", "package": "chylex.customwindowtitle.mixin",
"refmap": "customwindowtitle.refmap.json", "refmap": "customwindowtitle.refmap.json",
"compatibilityLevel": "JAVA_16", "compatibilityLevel": "JAVA_17",
"client": [ "client": [
"DisableVanillaTitle" "DisableVanillaTitle"
], ],

View File

@ -1,7 +1,7 @@
{ {
"pack": { "pack": {
"description": "${name}", "description": "${name}",
"pack_format": 5, "pack_format": 7,
"_comment": "" "_comment": ""
} }
} }