Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chat text decoration #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies {
modImplementation("net.silkmc:silk-commands:$silkVersion")

include(implementation("me.obsilabor", "alert", "1.0.8"))
include(implementation("org.jetbrains.kotlinx", "kotlinx-serialization-json", "1.7.0"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, consider using one format of dependency notations and not multiple across the buildscript

}

tasks {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package live.einfachgustaf.mods.smp.mixins;

import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.PlayerChatMessage;
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(PlayerChatMessage.class)
public class MixinPlayerChatMessage {

@Inject(at = @At("RETURN"), method = "decoratedContent", cancellable = true)
private void injectDecoratedContent(CallbackInfoReturnable<Component> cir) {
live.einfachgustaf.mods.smp.mixinkt.MixinPlayerChatMessage.INSTANCE.injectDecoratedContent(cir);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider importing the class

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package live.einfachgustaf.mods.smp.mixinkt

import net.minecraft.network.chat.Component
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable

object MixinPlayerChatMessage {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid duplicate class names please


fun injectDecoratedContent(cir: CallbackInfoReturnable<Component>) {
// TODO: MiniMessage Translation
}
}
5 changes: 5 additions & 0 deletions src/main/kotlin/live/einfachgustaf/mods/smp/utils/Global.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package live.einfachgustaf.mods.smp.utils

import net.kyori.adventure.text.minimessage.MiniMessage

val miniMessage = MiniMessage.miniMessage()
2 changes: 1 addition & 1 deletion src/main/resources/smp.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"defaultRequire": 0
},
"mixins": [

"MixinPlayerChatMessage"
]
}
Loading