mirror of
https://github.com/chylex/Minecraft-Window-Title.git
synced 2025-05-07 01:34:04 +02:00
Add merging build script & update README
This commit is contained in:
parent
c6102427aa
commit
d5e9bd5190
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
Build/
|
61
BuildMerge.py
Normal file
61
BuildMerge.py
Normal file
@ -0,0 +1,61 @@
|
||||
import subprocess
|
||||
import platform
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import shutil
|
||||
import zipfile
|
||||
|
||||
root = os.path.abspath(sys.path[0])
|
||||
builds = os.path.join(root, "Build")
|
||||
combined = os.path.join(builds, "Combined")
|
||||
outputjar = "CustomWindowTitle.jar"
|
||||
|
||||
gradlew = "gradlew.bat" if platform.system() == "Windows" else "gradlew"
|
||||
|
||||
def build(folder):
|
||||
separator = "========={}".format("=" * len(folder))
|
||||
|
||||
print(separator)
|
||||
print("Building {}".format(folder))
|
||||
print(separator)
|
||||
|
||||
libs = os.path.join(root, folder, "build", "libs")
|
||||
shutil.rmtree(libs)
|
||||
|
||||
os.chdir(os.path.join(root, folder))
|
||||
subprocess.run([gradlew, "build"])
|
||||
|
||||
for fname in os.listdir(libs):
|
||||
if "-dev" not in fname:
|
||||
global outputjar
|
||||
outputjar = fname
|
||||
|
||||
jar = os.path.join(builds, "{}.{}".format(folder, fname))
|
||||
shutil.copyfile(os.path.join(libs, fname), jar)
|
||||
|
||||
jar = zipfile.ZipFile(jar)
|
||||
jar.extractall(combined)
|
||||
jar.close()
|
||||
|
||||
break
|
||||
|
||||
if os.path.isdir(builds):
|
||||
shutil.rmtree(builds)
|
||||
time.sleep(0.25)
|
||||
|
||||
os.mkdir(builds)
|
||||
os.mkdir(combined)
|
||||
|
||||
# Forge must run last to overwrite MANIFEST.MF
|
||||
build("Fabric")
|
||||
build("Forge")
|
||||
|
||||
os.chdir(builds)
|
||||
|
||||
with zipfile.ZipFile(outputjar, "w", compression = zipfile.ZIP_DEFLATED, compresslevel = 9) as jar:
|
||||
for root, dirs, files in os.walk(combined):
|
||||
for fname in files:
|
||||
fname = os.path.join(root, fname)
|
||||
fname = os.path.normpath(fname)
|
||||
jar.write(fname, os.path.relpath(fname, combined))
|
42
README.md
42
README.md
@ -1,2 +1,40 @@
|
||||
# Minecraft-Window-Title
|
||||
Minecraft mod that lets you customize window title.
|
||||
# For Users
|
||||
|
||||
## Installation
|
||||
|
||||
The mod supports [Forge](https://files.minecraftforge.net/) and [Fabric](https://fabricmc.net/) (*) mod loaders, **the same mod file will work in both**. Follow either mod loader's installation guide, then [download the mod file](https://www.curseforge.com/minecraft/mc-mods/custom-window-title/files) for your Minecraft version, and install it into the **.minecraft/mods** folder.
|
||||
|
||||
(*) Fabric API is not required.
|
||||
|
||||
## Configuration
|
||||
|
||||
Run the game once to create the configuration file. By default, the window title will be set to **Minecraft _<version>_**. Unlike in vanilla 1.15.2 onwards, the title will not change when you enter a world/server.
|
||||
|
||||
To change the title, navigate to the **.minecraft/config** folder, and open **customwindowtitle-client.toml** in a text editor. You will see the following line:
|
||||
|
||||
```toml
|
||||
title = "Minecraft {mcversion}"
|
||||
```
|
||||
|
||||
Change only text inside the quotes. You can use the following special tokens:
|
||||
|
||||
* **{mcversion}** - current Minecraft version
|
||||
* **{modversion:<span style="text-decoration: underline;">modid</span>}** - version of installed mod with the identifier _modid_
|
||||
|
||||
If any of the tokens aren't working, search the game log for **CustomWindowTitle** and you should see the reason, otherwise please file an issue on the [issue tracker](https://github.com/chylex/Minecraft-Window-Title/issues) with as many details as possible.
|
||||
|
||||
## Screenshots
|
||||
|
||||
These screenshots were taken using the following example configuration:
|
||||
|
||||
```toml
|
||||
title = "Minecraft {mcversion} - Custom Window Title {modversion:customwindowtitle}"
|
||||
```
|
||||
|
||||

|
||||
|
||||
# For Developers
|
||||
|
||||
Currently the common source files (package `chylex.customwindowtitle`) are just duplicated in the Forge and Fabric folders, and the jar files are combined with a horrible python script. If anyone has the time and patience to clean it up, I'd appreciate a Pull Request :P
|
||||
|
||||
For now, you can build either separate Forge and Fabric projects using `gradlew build` in either folder, or run `python BuildMerge.py` to automatically build both and combine them into a single `.jar` file.
|
||||
|
Loading…
Reference in New Issue
Block a user