Skip to content

Commit

Permalink
Merge pull request #11 from Hendrix-Shen/Better-Menu-Title
Browse files Browse the repository at this point in the history
Better menu title
  • Loading branch information
Hendrix-Shen authored Sep 6, 2021
2 parents 7f2caf1 + b039c0b commit 4fa29a7
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 9 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Get commit id
id: getid
run: |
echo "::set-output name=commitID::${GITHUB_SHA::7}"
- name: Display commit id
run: |
echo MasaGadget commit-${{ steps.getid.outputs.commitID }} \(Public Beta\)
- name: Set commit id in codes
run: |
sed -i "s/build.undefined/${{ steps.getid.outputs.commitID }}/g" gradle.properties
sed -i "s/build.undefined/${{ steps.getid.outputs.commitID }}/g" src/main/java/com/plusls/MasaGadget/ModInfo.java
sed -i "s/Version Exception/Public Beta/g" src/main/java/com/plusls/MasaGadget/ModInfo.java
- name: Read relevant fields from gradle.properties
id: properties
run: |
path='./gradle.properties'
for property in minecraft_version_out mod_version_detail archives_base_name
do
result=$(sed -n "/^[[:space:]]*$property[[:space:]]*=[[:space:]]*/s/^[[:space:]]*$property[[:space:]]*=[[:space:]]*//p" "$path")
echo "$property: $result"
echo ::set-output name=$property::"$result"
done
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
Expand All @@ -28,5 +50,5 @@ jobs:
if: ${{ runner.os == 'Linux' && matrix.java == '16' }}
uses: actions/upload-artifact@v2
with:
name: Artifacts
name: ${{ steps.properties.outputs.archives_base_name }}-mc${{ steps.properties.outputs.minecraft_version_out }}-${{ steps.properties.outputs.mod_version_detail }}(Public Beta)
path: build/libs/
7 changes: 7 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Display build number
run: echo MasaGadget build\#$GITHUB_RUN_NUMBER \(Public Release\)
- name: Set build number in codes
run: |
sed -i "s/build.undefined/build.$GITHUB_RUN_NUMBER/g" gradle.properties
sed -i "s/build.undefined/build.$GITHUB_RUN_NUMBER/g" src/main/java/com/plusls/MasaGadget/ModInfo.java
sed -i "s/Version Exception/Public Release/g" src/main/java/com/plusls/MasaGadget/ModInfo.java
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ plugins {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = "${project.minecraft_version}-${project.mod_version}"
archivesBaseName = project.archives_base_name + '-mc' + project.minecraft_version_out
version = project.mod_version_detail
group = project.maven_group

repositories {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.17.1
minecraft_version_out = 1.17
yarn_mappings=1.17.1+build.49
loader_version=0.11.6

# Mod Properties
mod_version = 2.0.0
mod_version_detail = 2.0.0+build.undefined
maven_group = io.github.plusls
archives_base_name = MasaGadget
archives_base_name = MasaGadget-fabric

# malilib-fabric-1.17.1-0.10.0-dev.24.jar
malilib_version = 3387061
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/plusls/MasaGadget/ModInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

public class ModInfo {
public static String MOD_ID = "masa_gadget_mod";
public static final String MOD_NAME = "MasaGadget";
public static final String MOD_VERSION = "2.0.0-build.undefined";
public static final String MOD_VERSION_TYPE = "Version Exception";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);

public static Identifier id(String path) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/plusls/MasaGadget/gui/GuiConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import fi.dy.masa.malilib.gui.button.ButtonBase;
import fi.dy.masa.malilib.gui.button.ButtonGeneric;
import fi.dy.masa.malilib.gui.button.IButtonActionListener;
import fi.dy.masa.malilib.util.StringUtils;
import net.minecraft.client.resource.language.I18n;

import java.util.Collections;
Expand All @@ -18,7 +19,7 @@ public class GuiConfigs extends GuiConfigsBase {
public static ConfigGuiTab tab = ConfigGuiTab.GENERIC;

public GuiConfigs() {
super(10, 50, ModInfo.MOD_ID, null, String.format("%s.gui.title.configs", ModInfo.MOD_ID));
super(10, 50, ModInfo.MOD_ID, null, StringUtils.translate(String.format("%s.gui.title.configs", ModInfo.MOD_ID), ModInfo.MOD_VERSION, StringUtils.translate(String.format("%s.misc.versionType.%s", ModInfo.MOD_ID, ModInfo.MOD_VERSION_TYPE))));
}

@Override
Expand Down
8 changes: 6 additions & 2 deletions src/main/resources/assets/masa_gadget_mod/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"masa_gadget_mod.gui.title.configs": "MasaGadget Config",
"masa_gadget_mod.gui.title.configs": "MasaGadget - Config - Version: %s (%s)",
"masa_gadget_mod.gui.button.configGui.generic": "Generic",
"masa_gadget_mod.gui.button.configGui.litematica": "Litematica",
"masa_gadget_mod.gui.button.configGui.malilib": "Malilib",
Expand Down Expand Up @@ -33,5 +33,9 @@
"masa_gadget_mod.config.tweakeroo.inventoryPreviewSupportSelect.name": "inventoryPreviewSupportSelect",
"masa_gadget_mod.config.tweakeroo.inventoryPreviewSupportSelect.comment": "When player press the inventory preview hotkey, player can use the mouse wheel to select items (player can view the enchantment information), and when player select the shulker box in the chest, player can press the mouse scroll to preview the items in the box",
"masa_gadget_mod.config.tweakeroo.pcaSyncProtocol.name": "pcaSyncProtocol",
"masa_gadget_mod.config.tweakeroo.pcaSyncProtocol.comment": "Use pcaSyncProtocol to sync block entity data and entity data from server, such as chest, villager"
"masa_gadget_mod.config.tweakeroo.pcaSyncProtocol.comment": "Use pcaSyncProtocol to sync block entity data and entity data from server, such as chest, villager",

"masa_gadget_mod.misc.versionType.Public Beta": "Public Beta",
"masa_gadget_mod.misc.versionType.Public Release": "Public Release",
"masa_gadget_mod.misc.versionType.Version Exception": "Version Exception"
}
8 changes: 6 additions & 2 deletions src/main/resources/assets/masa_gadget_mod/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"masa_gadget_mod.gui.title.configs": "MasaGadget 配置",
"masa_gadget_mod.gui.title.configs": "MasaGadget 设置 - 版本: %s (%s)",
"masa_gadget_mod.gui.button.configGui.generic": "通用",
"masa_gadget_mod.gui.button.configGui.litematica": "Litematica",
"masa_gadget_mod.gui.button.configGui.malilib": "Malilib",
Expand Down Expand Up @@ -33,5 +33,9 @@
"masa_gadget_mod.config.tweakeroo.inventoryPreviewSupportSelect.name": "容器预览支持选中格子",
"masa_gadget_mod.config.tweakeroo.inventoryPreviewSupportSelect.comment": "按下容器预览快捷键时可以使用鼠标滚轮来选中物品(可以查看附魔信息),在选中箱子中的潜影盒时可以按下鼠标中键来预览盒子内的物品",
"masa_gadget_mod.config.tweakeroo.pcaSyncProtocol.name": "PCA 同步协议",
"masa_gadget_mod.config.tweakeroo.pcaSyncProtocol.comment": "使用 PCA 同步协议来从服务器同步方块实体信息和实体信息,比如箱子内的物品,村民背包"
"masa_gadget_mod.config.tweakeroo.pcaSyncProtocol.comment": "使用 PCA 同步协议来从服务器同步方块实体信息和实体信息,比如箱子内的物品,村民背包",

"masa_gadget_mod.misc.versionType.Public Beta": "公共测试版",
"masa_gadget_mod.misc.versionType.Public Release": "公共发行版",
"masa_gadget_mod.misc.versionType.Version Exception": "版本异常"
}

0 comments on commit 4fa29a7

Please sign in to comment.