Skip to content

Commit

Permalink
1.20.3/4 support; add config; import polish
Browse files Browse the repository at this point in the history
  • Loading branch information
Wulian233 committed Oct 7, 2024
1 parent 27b5984 commit 137ffe2
Show file tree
Hide file tree
Showing 31 changed files with 191 additions and 236 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on: [ pull_request, push, workflow_dispatch ]

jobs:
Build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
- name: Cache
uses: actions/cache@v4
with:
Expand All @@ -30,28 +30,28 @@ jobs:
- name: Merge Fabric & Forge & NeoForge JARs
run: |
chmod +x gradlew
./gradlew mergeJars
./gradlew fusejars
- name: Upload artifacts (fabric)
- name: Upload fabric artifacts
uses: actions/upload-artifact@v4
with:
name: fabric
name: fabric-artifacts
path: ${{ github.workspace }}/fabric/build/libs

- name: Upload artifacts (forge)
- name: Upload forge artifacts
uses: actions/upload-artifact@v4
with:
name: forge
name: neoforge-artifacts
path: ${{ github.workspace }}/forge/build/libs

- name: Upload artifacts (neoforge)
- name: Upload neoforge artifacts
uses: actions/upload-artifact@v4
with:
name: neoforge
name: neoforge-artifacts
path: ${{ github.workspace }}/neoforge/build/libs

- name: Upload artifacts (Forgix merged jar)
- name: Upload merged artifacts
uses: actions/upload-artifact@v4
with:
name: merged
path: ${{ github.workspace }}/build/libs/forgix
name: merged-artifacts
path: ${{ github.workspace }}/build/merged/*
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
MIT License

Copyright (c) 2024 Wulian233
Copyright (c) 2024 Wulian233, TexTrue

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
in the Software without restriction, including, without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

[![GitHub license](https://img.shields.io/github/license/Wulian233/Chat-Impressive-Animation?style=flat-square)](LICENSE)
![Environment: Client](https://img.shields.io/badge/environment-client-1976d2?style=flat-square)
[![CurseForge-badge](https://img.shields.io/curseforge/dt/972468?style=flat-square&logo=curseforge&label=CurseForge)](https://minecraft.curseforge.com/projects/972468/files)
![Modrinth Downloads](https://img.shields.io/modrinth/dt/chat-impressive-animation?label=Modrinth&logo=Modrinth&style=flat-square)

[简体中文](README_ZH.md) English

Expand Down
2 changes: 2 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

[![GitHub license](https://img.shields.io/github/license/Wulian233/Chat-Impressive-Animation?style=flat-square)](LICENSE)
![Environment: Client](https://img.shields.io/badge/environment-client-1976d2?style=flat-square)
[![CurseForge-badge](https://img.shields.io/curseforge/dt/972468?style=flat-square&logo=curseforge&label=CurseForge)](https://minecraft.curseforge.com/projects/972468/files)
![Modrinth Downloads](https://img.shields.io/modrinth/dt/chat-impressive-animation?label=Modrinth&logo=Modrinth&style=flat-square)

[English](README.md) 简体中文

Expand Down
51 changes: 25 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "io.github.pacifistmc.forgix" version "1.+"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "com.hypherionmc.modutils.modfusioner" version "1.0.+"
id "com.github.johnrengelman.shadow" version "8.+" apply false
}

Expand Down Expand Up @@ -31,35 +31,34 @@ allprojects {
repositories {
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 17
}

java {
java {
withSourcesJar()
}

forgix {
group = rootProject.maven_group
mergedJarName = "${rootProject.archives_base_name}-${rootProject.version}.jar"
outputDir = "build/libs/forgix"
fusioner {
packageGroup = rootProject.maven_group
mergedJarName = "${rootProject.archives_base_name}"
outputDirectory = "build/merged"
jarVersion = rootProject.version

forge {
projectName = "forge"
jarLocation = "build/libs/${rootProject.archives_base_name}-forge-${rootProject.version}.jar"
}
forge {
projectName = "forge"
inputTaskName = "remapJar"
}

fabric {
projectName = "fabric"
jarLocation = "build/libs/${rootProject.archives_base_name}-fabric-${rootProject.version}.jar"
}
neoforge {
projectName = "neoforge"
inputTaskName = "remapJar"
}

custom {
projectName = "neoforge"
jarLocation = "build/libs/${rootProject.archives_base_name}-neoforge-${ rootProject.version }.jar"
}
}

mergeJars.dependsOn(build)
fabric {
projectName = "fabric"
inputTaskName = "remapJar"
}
}
}
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
modApi "dev.architectury:architectury:${rootProject.architectury_version}"
modApi "me.shedaniel.cloth:cloth-config:${rootProject.clothconfig_version}"

compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.0"))
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.wulian.chatimpressiveanimation.config;

import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;

public class ConfigUtil {
private static ModConfigs modConfigs;

public static ModConfigs getConfig() {
if (modConfigs == null) {
AutoConfig.register(ModConfigs.class, GsonConfigSerializer::new);
modConfigs = AutoConfig.getConfigHolder(ModConfigs.class).getConfig();
}
return modConfigs;
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
package com.wulian.chatimpressiveanimation.config;

import com.wulian.chatimpressiveanimation.ChatImpressiveAnimation;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import net.minecraft.client.gui.screen.Screen;

@Config(name = ChatImpressiveAnimation.MOD_ID)
public class ModConfigs implements ConfigData {
public boolean enableOpenChatAnimation = true;
public boolean enableChatSendingAnimation = true;
public boolean enableOpenChatAnimation = true;
public boolean removeMessageIndicator = true;

public static ModConfigs createConfig() {
return AutoConfig.register(ModConfigs.class, GsonConfigSerializer::new).getConfig();
}

public static Screen createConfigScreen(Screen parent) {
return AutoConfig.getConfigScreen(ModConfigs.class, parent).get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.wulian.chatimpressiveanimation.mixin;

import com.wulian.chatimpressiveanimation.config.ConfigUtil;
import net.minecraft.client.gui.hud.ChatHudLine;
import net.minecraft.client.gui.hud.MessageIndicator;
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.CallbackInfoReturnable;

@Mixin(ChatHudLine.Visible.class)
public class ChatHudLineVisibleMixin {
@Inject(method = "indicator", at = @At("HEAD"), cancellable = true)
private void injectIndicator(CallbackInfoReturnable<MessageIndicator> cir) {
if (ConfigUtil.getConfig().removeMessageIndicator){
cir.setReturnValue(null);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.wulian.chatimpressiveanimation.mixin;

import com.wulian.chatimpressiveanimation.config.ModConfigs;
import com.wulian.chatimpressiveanimation.config.ConfigUtil;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
Expand All @@ -18,6 +18,7 @@ public class ChatScreenMixin {

@Inject(method = "render", at = @At("HEAD"))
private void render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (!ConfigUtil.getConfig().enableOpenChatAnimation) return;
MinecraftClient client = MinecraftClient.getInstance();
if (client.player != null) {
if (!wasOpenedLastFrame && !client.player.isSleeping()) {
Expand All @@ -43,6 +44,7 @@ private void render(DrawContext context, int mouseX, int mouseY, float delta, Ca

@Inject(method = "render", at = @At("TAIL"))
private void renderEnd(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
context.getMatrices().translate(0, -offsetY, 0);
if (!ConfigUtil.getConfig().enableChatSendingAnimation) return;
context.getMatrices().translate(0, -offsetY, 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"modmenu.nameTranslation.chatimpressiveanimation": "uoı̣ʇɐɯı̣uⱯ ǝʌı̣ssǝɹdɯI ʇɐɥƆ",
"modmenu.descriptionTranslation.chatimpressiveanimation": "˙ɹoʇɐɔı̣puı̣ ǝƃɐssǝɯ ǝɥʇ sǝʌoɯǝɹ osןɐ ʇI ˙sǝƃɐssǝɯ ƃuı̣puǝs 'ʇɐɥɔ ƃuı̣uǝdo sɐ ɥɔnS ˙suoı̣ʇɐɯı̣uɐ ƃuı̣ppɐ ʎq ɹǝʇʇǝq ʞooן ʇɐɥɔ ǝɥʇ sǝʞɐɯ poɯ sı̣ɥꓕ",

"text.autoconfig.chatimpressiveanimation.title": "uoı̣ʇɐɯı̣uⱯ ǝʌı̣ssǝɹdɯI ʇɐɥƆ",
"text.autoconfig.chatimpressiveanimation.option.enableChatSendingAnimation": "uoı̣ʇɐɯı̣uɐ ƃuı̣puǝs ǝƃɐssǝɯ ǝןqɐuƎ",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "uoı̣ʇɐɯı̣uɐ ʇɐɥɔ uǝdo ǝןqɐuƎ",
"text.autoconfig.chatimpressiveanimation.option.removeMessageIndicator": "ɹoʇɐɔı̣puı̣ ǝƃɐssǝɯ ǝɥʇ sǝʌoɯǝꓤ"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modmenu.descriptionTranslation.chatimpressiveanimation": "This mod makes the chat look better by adding animations. Such as opening chat, sending messages. It also removes the message indicator.",

"text.autoconfig.chatimpressiveanimation.title": "Chat Impressive Animation",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "Enable open chat animation",
"text.autoconfig.chatimpressiveanimation.option.enableChatSendingAnimation": "Enable message sending animation",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "Enable open chat animation",
"text.autoconfig.chatimpressiveanimation.option.removeMessageIndicator": "Removes the message indicator"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modmenu.descriptionTranslation.chatimpressiveanimation": "添加了一些关于聊天栏的动画,如打开聊天栏,发送消息等。同时删除了提示类消息左侧的白条",

"text.autoconfig.chatimpressiveanimation.title": "聊动魅影",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "启用打开聊天栏动画",
"text.autoconfig.chatimpressiveanimation.option.enableChatSendingAnimation": "启用消息发送动画",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "启用打开聊天栏动画",
"text.autoconfig.chatimpressiveanimation.option.removeMessageIndicator": "删除提示类消息左侧的白条"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"modmenu.nameTranslation.chatimpressiveanimation": "聊動魅影",
"modmenu.descriptionTranslation.chatimpressiveanimation": "添加了一些關於聊天欄的動畫,如打開聊天欄,發送消息等。同時刪除了提示類消息左側的白條",

"text.autoconfig.chatimpressiveanimation.title": "聊動魅影",
"text.autoconfig.chatimpressiveanimation.option.enableChatSendingAnimation": "啟用消息發送動畫",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "啟用打開聊天欄動畫",
"text.autoconfig.chatimpressiveanimation.option.removeMessageIndicator": "刪除提示類消息左側的白條"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"modmenu.nameTranslation.chatimpressiveanimation": "聊動魅影",
"modmenu.descriptionTranslation.chatimpressiveanimation": "添加了一些關於聊天欄的動畫,如打開聊天欄,發送消息等。同時刪除了提示類消息左側的白條",

"text.autoconfig.chatimpressiveanimation.title": "聊動魅影",
"text.autoconfig.chatimpressiveanimation.option.enableChatSendingAnimation": "啟用消息發送動畫",
"text.autoconfig.chatimpressiveanimation.option.enableOpenChatAnimation": "啟用打開聊天欄動畫",
"text.autoconfig.chatimpressiveanimation.option.removeMessageIndicator": "刪除提示類消息左側的白條"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "com.wulian.chatimpressiveanimation.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"ChatHudLineVisibleMixin",
"ChatScreenMixin"
],
"injectors": {
Expand Down
34 changes: 11 additions & 23 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ architectury {
project.archivesBaseName = rootProject.archivesBaseName + "-fabric"

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
common {
canBeResolved = true
canBeConsumed = false
}
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
shadowBundle {
canBeResolved = true
canBeConsumed = false
}
}

repositories {
Expand All @@ -25,7 +31,7 @@ dependencies {
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
shadowBundle(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }

modApi "me.shedaniel.cloth:cloth-config-fabric:${rootProject.clothconfig_version}"
modApi "com.terraformersmc:modmenu:${rootProject.modmenu_version}"
Expand All @@ -43,12 +49,12 @@ processResources {
shadowJar {
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
configurations = [project.configurations.shadowBundle]
archiveClassifier.set("dev-shadow")
}

remapJar {
input.set shadowJar.archiveFile
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set(null)
}
Expand All @@ -62,21 +68,3 @@ sourcesJar {
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

repositories {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.shedaniel.autoconfig.AutoConfig;
import com.wulian.chatimpressiveanimation.config.ModConfigs;
import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

public class ModMenuCompat implements ModMenuApi{
@Environment(EnvType.CLIENT)
class ModMenuCompat implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return screen -> AutoConfig.getConfigScreen(ModConfigs.class, screen).get();
return parent -> AutoConfig.getConfigScreen(ModConfigs.class, parent).get();
}
}



Loading

0 comments on commit 137ffe2

Please sign in to comment.