From 81492567d201dd1e2ccea724a0a7063f586ac253 Mon Sep 17 00:00:00 2001 From: VAKiliner <119078586+vakiliner@users.noreply.github.com> Date: Sun, 25 Jan 2026 17:14:05 +0300 Subject: [PATCH] refactor: Rename StyleMixin to StyleAccessor --- .../chatcomponentapi/fabric/FabricParser.java | 26 +++++++++---------- .../{StyleMixin.java => StyleAccessor.java} | 2 +- .../chatcomponentapi/forge/ForgeParser.java | 26 +++++++++---------- .../{StyleMixin.java => StyleAccessor.java} | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) rename fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/{StyleMixin.java => StyleAccessor.java} (97%) rename forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/{StyleMixin.java => StyleAccessor.java} (97%) diff --git a/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/FabricParser.java b/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/FabricParser.java index 34f4767..3351715 100644 --- a/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/FabricParser.java +++ b/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/FabricParser.java @@ -46,7 +46,7 @@ import vakiliner.chatcomponentapi.component.ChatStyle; import vakiliner.chatcomponentapi.component.ChatTextComponent; import vakiliner.chatcomponentapi.component.ChatTranslateComponent; -import vakiliner.chatcomponentapi.fabric.mixin.StyleMixin; +import vakiliner.chatcomponentapi.fabric.mixin.StyleAccessor; public class FabricParser extends BaseParser { public boolean supportsSeparatorInSelector() { @@ -139,24 +139,24 @@ public static ChatComponent fabric(Component raw) { public static Style fabric(ChatStyle chatStyle) { if (chatStyle == null) return null; if (chatStyle.isEmpty()) return Style.EMPTY; - return StyleMixin.newStyle(fabric(chatStyle.getColor()), chatStyle.getBold(), chatStyle.getItalic(), chatStyle.getUnderlined(), chatStyle.getStrikethrough(), chatStyle.getObfuscated(), fabric(chatStyle.getClickEvent()), fabric(chatStyle.getHoverEvent()), chatStyle.getInsertion(), fabric(chatStyle.getFont())); + return StyleAccessor.newStyle(fabric(chatStyle.getColor()), chatStyle.getBold(), chatStyle.getItalic(), chatStyle.getUnderlined(), chatStyle.getStrikethrough(), chatStyle.getObfuscated(), fabric(chatStyle.getClickEvent()), fabric(chatStyle.getHoverEvent()), chatStyle.getInsertion(), fabric(chatStyle.getFont())); } public static ChatStyle fabric(Style style) { if (style == null) return null; if (style.isEmpty()) return ChatStyle.EMPTY; - StyleMixin mixin = (StyleMixin) style; + StyleAccessor accessor = (StyleAccessor) style; ChatStyle.Builder builder = ChatStyle.newBuilder(); - builder.withColor(fabric(style.getColor())); - builder.withBold(mixin.getBold()); - builder.withItalic(mixin.getItalic()); - builder.withUnderlined(mixin.getUnderlined()); - builder.withStrikethrough(mixin.getStrikethrough()); - builder.withObfuscated(mixin.getObfuscated()); - builder.withClickEvent(fabric(style.getClickEvent())); - builder.withHoverEvent(fabric(mixin.getHoverEvent())); - builder.withInsertion(style.getInsertion()); - builder.withFont(fabric(mixin.getFont())); + builder.withColor(fabric(accessor.getColor())); + builder.withBold(accessor.getBold()); + builder.withItalic(accessor.getItalic()); + builder.withUnderlined(accessor.getUnderlined()); + builder.withStrikethrough(accessor.getStrikethrough()); + builder.withObfuscated(accessor.getObfuscated()); + builder.withClickEvent(fabric(accessor.getClickEvent())); + builder.withHoverEvent(fabric(accessor.getHoverEvent())); + builder.withInsertion(accessor.getInsertion()); + builder.withFont(fabric(accessor.getFont())); return builder.build(); } diff --git a/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/StyleMixin.java b/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/StyleAccessor.java similarity index 97% rename from fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/StyleMixin.java rename to fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/StyleAccessor.java index d8d4f9f..cc5a905 100644 --- a/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/StyleMixin.java +++ b/fabric/src/main/java/vakiliner/chatcomponentapi/fabric/mixin/StyleAccessor.java @@ -10,7 +10,7 @@ import net.minecraft.resources.ResourceLocation; @Mixin(Style.class) -public interface StyleMixin { +public interface StyleAccessor { @Invoker("") static Style newStyle(TextColor textColor, Boolean bold, Boolean italic, Boolean underlined, Boolean strikethrough, Boolean obfuscated, ClickEvent clickEvent, HoverEvent hoverEvent, String insertion, ResourceLocation font) { throw new AssertionError(); diff --git a/forge/src/main/java/vakiliner/chatcomponentapi/forge/ForgeParser.java b/forge/src/main/java/vakiliner/chatcomponentapi/forge/ForgeParser.java index 83738cb..79cd10d 100644 --- a/forge/src/main/java/vakiliner/chatcomponentapi/forge/ForgeParser.java +++ b/forge/src/main/java/vakiliner/chatcomponentapi/forge/ForgeParser.java @@ -43,7 +43,7 @@ import vakiliner.chatcomponentapi.component.ChatStyle; import vakiliner.chatcomponentapi.component.ChatTextComponent; import vakiliner.chatcomponentapi.component.ChatTranslateComponent; -import vakiliner.chatcomponentapi.forge.mixin.StyleMixin; +import vakiliner.chatcomponentapi.forge.mixin.StyleAccessor; public class ForgeParser extends BaseParser { public boolean supportsSeparatorInSelector() { @@ -125,24 +125,24 @@ public static ChatComponent forge(ITextComponent raw) { public static Style forge(ChatStyle chatStyle) { if (chatStyle == null) return null; if (chatStyle.isEmpty()) return Style.EMPTY; - return StyleMixin.newStyle(forge(chatStyle.getColor()), chatStyle.getBold(), chatStyle.getItalic(), chatStyle.getUnderlined(), chatStyle.getStrikethrough(), chatStyle.getObfuscated(), forge(chatStyle.getClickEvent()), forge(chatStyle.getHoverEvent()), chatStyle.getInsertion(), forge(chatStyle.getFont())); + return StyleAccessor.newStyle(forge(chatStyle.getColor()), chatStyle.getBold(), chatStyle.getItalic(), chatStyle.getUnderlined(), chatStyle.getStrikethrough(), chatStyle.getObfuscated(), forge(chatStyle.getClickEvent()), forge(chatStyle.getHoverEvent()), chatStyle.getInsertion(), forge(chatStyle.getFont())); } public static ChatStyle forge(Style style) { if (style == null) return null; if (style.isEmpty()) return ChatStyle.EMPTY; - StyleMixin mixin = (StyleMixin) style; + StyleAccessor accessor = (StyleAccessor) style; ChatStyle.Builder builder = ChatStyle.newBuilder(); - builder.withColor(forge(mixin.getColor())); - builder.withBold(mixin.getBold()); - builder.withItalic(mixin.getItalic()); - builder.withUnderlined(mixin.getUnderlined()); - builder.withStrikethrough(mixin.getStrikethrough()); - builder.withObfuscated(mixin.getObfuscated()); - builder.withClickEvent(forge(mixin.getClickEvent())); - builder.withHoverEvent(forge(mixin.getHoverEvent())); - builder.withInsertion(mixin.getInsertion()); - builder.withFont(forge(mixin.getFont())); + builder.withColor(forge(accessor.getColor())); + builder.withBold(accessor.getBold()); + builder.withItalic(accessor.getItalic()); + builder.withUnderlined(accessor.getUnderlined()); + builder.withStrikethrough(accessor.getStrikethrough()); + builder.withObfuscated(accessor.getObfuscated()); + builder.withClickEvent(forge(accessor.getClickEvent())); + builder.withHoverEvent(forge(accessor.getHoverEvent())); + builder.withInsertion(accessor.getInsertion()); + builder.withFont(forge(accessor.getFont())); return builder.build(); } diff --git a/forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/StyleMixin.java b/forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/StyleAccessor.java similarity index 97% rename from forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/StyleMixin.java rename to forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/StyleAccessor.java index 157d0eb..c9ab9db 100644 --- a/forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/StyleMixin.java +++ b/forge/src/main/java/vakiliner/chatcomponentapi/forge/mixin/StyleAccessor.java @@ -10,7 +10,7 @@ import net.minecraft.util.text.event.HoverEvent; @Mixin(Style.class) -public interface StyleMixin { +public interface StyleAccessor { @Invoker("") static Style newStyle(Color сolor, Boolean bold, Boolean italic, Boolean underlined, Boolean strikethrough, Boolean obfuscated, ClickEvent clickEvent, HoverEvent hoverEvent, String insertion, ResourceLocation font) { throw new AssertionError();