mirror of
https://github.com/chylex/Minecraft-Window-Title.git
synced 2025-05-05 22:34:05 +02:00
Backport to 1.14.x
This commit is contained in:
parent
12925e3fe3
commit
016d8a4840
Fabric
Forge
@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.15.2
|
||||
yarn_mappings=1.15.2+build.1
|
||||
loader_version=0.7.5+build.178
|
||||
minecraft_version=1.14.4
|
||||
yarn_mappings=1.14.4+build.15
|
||||
loader_version=0.7.8+build.184
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0
|
||||
@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.4.29+build.290-1.15
|
||||
fabric_version=0.4.2+build.246-1.14
|
||||
|
@ -4,6 +4,7 @@ import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
@ -40,10 +41,10 @@ public class CustomWindowTitle implements ClientModInitializer{
|
||||
}
|
||||
|
||||
TokenData.register();
|
||||
MinecraftClient.getInstance().execute(this::updateTitle);
|
||||
MinecraftClient.getInstance().method_18858(this::updateTitle);
|
||||
}
|
||||
|
||||
private void updateTitle(){
|
||||
MinecraftClient.getInstance().getWindow().setTitle(TitleParser.parse(configTitle));
|
||||
GLFW.glfwSetWindowTitle(MinecraftClient.getInstance().window.getHandle(), TitleParser.parse(configTitle));
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
package chylex.customwindowtitle.fabric.mixin;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public final class DisableVanillaTitle{
|
||||
@Inject(method = "updateWindowTitle()V", at = @At("HEAD"), cancellable = true)
|
||||
private void updateTitle(CallbackInfo info){
|
||||
info.cancel();
|
||||
}
|
||||
}
|
@ -21,12 +21,9 @@
|
||||
"chylex.customwindowtitle.fabric.CustomWindowTitle"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.2",
|
||||
"minecraft": "1.15.x"
|
||||
"minecraft": "1.14.x"
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "chylex.customwindowtitle.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"DisableVanillaTitle"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@ buildscript{
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
def mcversion = "1.15.2"
|
||||
def forgeversion = "31.0.14"
|
||||
def mcversion = "1.14.4"
|
||||
def forgeversion = "28.2.0"
|
||||
|
||||
def prefixName = 'displayName = '
|
||||
def prefixVersion = 'version = '
|
||||
@ -30,7 +30,7 @@ archivesBaseName = metaName.replaceAll('\\s', '')
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||
|
||||
minecraft{
|
||||
mappings channel: 'snapshot', version: '20200130-1.15.1'
|
||||
mappings channel: 'snapshot', version: '20200119-1.14.4'
|
||||
|
||||
runs{
|
||||
client{
|
||||
|
@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig.Type;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@Mod("customwindowtitle")
|
||||
public class CustomWindowTitle{
|
||||
@ -27,10 +28,10 @@ public class CustomWindowTitle{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientSetup(FMLClientSetupEvent e){
|
||||
e.getMinecraftSupplier().get().execute(this::updateTitle);
|
||||
e.getMinecraftSupplier().get().enqueue(this::updateTitle);
|
||||
}
|
||||
|
||||
private void updateTitle(){
|
||||
Minecraft.getInstance().getMainWindow().func_230148_b_(TitleParser.parse(configTitle.get()));
|
||||
GLFW.glfwSetWindowTitle(Minecraft.getInstance().mainWindow.getHandle(), TitleParser.parse(configTitle.get()));
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"CustomWindowTitle": "coremods/main.js"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[31,)"
|
||||
loaderVersion = "[26,)"
|
||||
|
||||
authors = "chylex"
|
||||
issueTrackerURL = "https://github.com/chylex/Minecraft-Window-Title/issues"
|
||||
@ -13,13 +13,13 @@ displayURL = "https://github.com/chylex/Minecraft-Window-Title"
|
||||
[[dependencies.customwindowtitle]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.15.2,)"
|
||||
versionRange = "[1.14,1.15)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.customwindowtitle]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[31,)"
|
||||
versionRange = "[26,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
@ -1,19 +0,0 @@
|
||||
function initializeCoreMod(){
|
||||
var opcodes = Java.type("org.objectweb.asm.Opcodes");
|
||||
var InsnNode = Java.type("org.objectweb.asm.tree.InsnNode");
|
||||
|
||||
return {
|
||||
"CustomWindowTitle": {
|
||||
"target": {
|
||||
"type": "METHOD",
|
||||
"class": "net.minecraft.client.Minecraft",
|
||||
"methodName": "func_230150_b_",
|
||||
"methodDesc": "()V"
|
||||
},
|
||||
"transformer": function(methodNode){
|
||||
methodNode.instructions.insert(new InsnNode(opcodes.RETURN));
|
||||
return methodNode;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user