diff --git a/README.md b/README.md index 03da0342..38a7f346 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,8 @@ All changes are toggleable via config files. * **Extinguishing Dodges:** Chance per dodge to extinguish the player when burning * **Feathers Helper API Fix:** Fixes server-sided crashes when the Feathers Helper API is utilized * **Sprinting Integration:** Configurable consumption of feathers when the player is sprinting +* **Emojicord** + * **Emoji Context:** Improves emoji context calculation to improve fps when rendering a lot of text * **Ender Storage** * **Fix Frequency Tracking:** Fixes storage frequencies being tracked multiple times * **Epic Siege Mod** diff --git a/dependencies.gradle b/dependencies.gradle index 1dcb2d02..eb740d65 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -80,6 +80,7 @@ final def mod_dependencies = [ 'curse.maven:effortlessbuilding-302113:2847346' : [debug_effortless_building], 'curse.maven:elementary-staffs-346007:2995593' : [debug_elementary_staffs], 'curse.maven:elenaidodge2-442962:3343308' : [debug_elenai_dodge_2], + 'curse.maven:emojicord-349107:4000684' : [debug_emojicord], 'curse.maven:enderstorage-245174:2755787' : [debug_enderstorage], 'curse.maven:epic-siege-mod-229449:3356157' : [debug_epic_siege_mod], 'curse.maven:extrautilities-225561:2678374' : [debug_extra_utilities_2], diff --git a/gradle.properties b/gradle.properties index b94240cc..abe0ebc5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,6 +24,7 @@ debug_crafttweaker = false debug_effortless_building = false debug_elementary_staffs = false debug_elenai_dodge_2 = false +debug_emojicord = false debug_enderio = false debug_enderstorage = false debug_epic_siege_mod = false diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 20a957f3..0286ea84 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -87,6 +87,10 @@ public class UTConfigMods @Config.Name("Elenai Dodge 2") public static final ElenaiDodge2Category ELENAI_DODGE_2 = new ElenaiDodge2Category(); + @Config.LangKey("cfg.universaltweaks.modintegration.emojicord") + @Config.Name("Emojicord") + public static final EmojicordCategory EMOJICORD = new EmojicordCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.enderstorage") @Config.Name("Ender Storage") public static final EnderStorageCategory ENDER_STORAGE = new EnderStorageCategory(); @@ -443,6 +447,14 @@ public static class ElenaiDodge2Category public int utED2SprintingFeatherRequirement = 6; } + public static class EmojicordCategory + { + @Config.RequiresMcRestart + @Config.Name("Emoji Context") + @Config.Comment("Improves emoji context calculation to improve fps when rendering a lot of text") + public boolean utEmojiContextToggle = true; + } + public static class EnderStorageCategory { @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 653842ad..0388875d 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -12,6 +12,7 @@ import mod.acgaming.universaltweaks.UniversalTweaks; import mod.acgaming.universaltweaks.config.UTConfigBugfixes; import mod.acgaming.universaltweaks.config.UTConfigGeneral; +import mod.acgaming.universaltweaks.config.UTConfigMods; import mod.acgaming.universaltweaks.config.UTConfigTweaks; import mod.acgaming.universaltweaks.util.UTReflectionUtil; import zone.rong.mixinbooter.IEarlyMixinLoader; @@ -152,6 +153,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.world.village.json", () -> UTConfigTweaks.WORLD.utVillageDistance != 32); } }); + public static boolean emojicordLoaded; public static boolean openModsLoaded; public static boolean surgeLoaded; private static final Map> clientsideMixinConfigs = ImmutableMap.copyOf(new HashMap>() @@ -171,6 +173,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.bugfixes.misc.spectatormenu.json", () -> UTConfigBugfixes.MISC.utSpectatorMenuToggle); put("mixins.bugfixes.misc.startup.json", () -> UTConfigTweaks.PERFORMANCE.utFasterBackgroundStartupToggle); put("mixins.bugfixes.world.frustumculling.json", () -> UTConfigBugfixes.WORLD.utFrustumCullingToggle); + put("mixins.mods.emojicord.emojicontext.json", () -> UTConfigMods.EMOJICORD.utEmojiContextToggle && emojicordLoaded); put("mixins.tweaks.blocks.betterplacement.json", () -> UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementToggle); put("mixins.tweaks.blocks.hitdelay.json", () -> UTConfigTweaks.BLOCKS.utBlockHitDelay != 5); put("mixins.tweaks.entities.autojump.json", () -> UTConfigTweaks.ENTITIES.utAutoJumpToggle); @@ -232,6 +235,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader Locale.setDefault(Locale.ENGLISH); } + emojicordLoaded = UTReflectionUtil.isClassLoaded("net.teamfruit.emojicord.asm.EmojicordCorePlugin"); openModsLoaded = UTReflectionUtil.isClassLoaded("openmods.core.OpenModsClassTransformer"); randomPatchesLoaded = UTReflectionUtil.isClassLoaded("com.therandomlabs.randompatches.core.RPCore"); renderLibLoaded = UTReflectionUtil.isClassLoaded("meldexun.renderlib.RenderLib"); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/EmojiFontRendererContext.java b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/EmojiFontRendererContext.java new file mode 100644 index 00000000..72feaead --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/EmojiFontRendererContext.java @@ -0,0 +1,9 @@ +package mod.acgaming.universaltweaks.mods.emojicord.emojicontext; + +public class EmojiFontRendererContext +{ + + public static boolean isChatInput; + public static boolean isChatMessage; + +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTEmojiFontRendererMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTEmojiFontRendererMixin.java new file mode 100644 index 00000000..e5ce0662 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTEmojiFontRendererMixin.java @@ -0,0 +1,39 @@ +package mod.acgaming.universaltweaks.mods.emojicord.emojicontext.mixin; + +import java.util.EnumSet; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; + +import mod.acgaming.universaltweaks.mods.emojicord.emojicontext.EmojiFontRendererContext; +import net.teamfruit.emojicord.EmojicordConfig; +import net.teamfruit.emojicord.emoji.EmojiContext; +import net.teamfruit.emojicord.emoji.EmojiContext.EmojiContextAttribute; +import net.teamfruit.emojicord.emoji.EmojiFontRenderer; + +@Mixin(value = EmojiFontRenderer.class, remap = false) +public class UTEmojiFontRendererMixin +{ + + @Shadow(remap = false) + private static EmojiContext CurrentContext; + + @Overwrite(remap = false) + public static String updateEmojiContext(final String text) + { + if (EmojicordConfig.spec.isAvailable() && EmojicordConfig.RENDER.renderEnabled.get()) + { + final EnumSet attributes = EnumSet.noneOf(EmojiContextAttribute.class); + if (EmojiFontRendererContext.isChatInput) + attributes.add(EmojiContextAttribute.CHAT_INPUT); + if (EmojiFontRendererContext.isChatMessage) + attributes.add(EmojiContextAttribute.CHAT_MESSAGE); + CurrentContext = EmojiContext.EmojiContextCache.instance.getContext(text, attributes); + return CurrentContext.text; + } + CurrentContext = null; + return text; + } + +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTGuiChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTGuiChatMixin.java new file mode 100644 index 00000000..55396fa8 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTGuiChatMixin.java @@ -0,0 +1,28 @@ +package mod.acgaming.universaltweaks.mods.emojicord.emojicontext.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import mod.acgaming.universaltweaks.mods.emojicord.emojicontext.EmojiFontRendererContext; +import net.minecraft.client.gui.GuiChat; + +@Mixin(GuiChat.class) +public class UTGuiChatMixin +{ + + @ModifyVariable(method = "drawScreen", at = @At("HEAD"), index = 3, ordinal = 0, name = "partialTicks") + private float pre_drawScreen(float partialTicks) + { + EmojiFontRendererContext.isChatInput = true; + return partialTicks; + } + + @ModifyVariable(method = "drawScreen", at = @At("RETURN"), index = 3, ordinal = 0, name = "partialTicks") + private float post_drawScreen(float partialTicks) + { + EmojiFontRendererContext.isChatInput = false; + return partialTicks; + } + +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTGuiNewChatMixin.java new file mode 100644 index 00000000..2a7e44ab --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/emojicord/emojicontext/mixin/UTGuiNewChatMixin.java @@ -0,0 +1,28 @@ +package mod.acgaming.universaltweaks.mods.emojicord.emojicontext.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import mod.acgaming.universaltweaks.mods.emojicord.emojicontext.EmojiFontRendererContext; +import net.minecraft.client.gui.GuiNewChat; + +@Mixin(GuiNewChat.class) +public class UTGuiNewChatMixin +{ + + @ModifyVariable(method = "drawChat", at = @At("HEAD"), index = 1, ordinal = 0, name = "updateCounter") + private int pre_drawChat(int updateCounter) + { + EmojiFontRendererContext.isChatMessage = true; + return updateCounter; + } + + @ModifyVariable(method = "drawChat", at = @At("RETURN"), index = 1, ordinal = 0, name = "updateCounter") + private int post_drawChat(int updateCounter) + { + EmojiFontRendererContext.isChatMessage = false; + return updateCounter; + } + +} diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index 1520abcc..4ea7577e 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -66,6 +66,7 @@ cfg.universaltweaks.modintegration.cqrepoured=Chocolate Quest Repoured cfg.universaltweaks.modintegration.effortlessbuilding=Effortless Building cfg.universaltweaks.modintegration.elementarystaffs=Elementary Staffs cfg.universaltweaks.modintegration.elenaidodge2=Elenai Dodge 2 +cfg.universaltweaks.modintegration.emojicord=Emojicord cfg.universaltweaks.modintegration.enderstorage=Ender Storage cfg.universaltweaks.modintegration.erebus=The Erebus cfg.universaltweaks.modintegration.esm=Epic Siege Mod diff --git a/src/main/resources/mixins.mods.emojicord.emojicontext.json b/src/main/resources/mixins.mods.emojicord.emojicontext.json new file mode 100644 index 00000000..7d4ba3cb --- /dev/null +++ b/src/main/resources/mixins.mods.emojicord.emojicontext.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.emojicord.emojicontext.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTEmojiFontRendererMixin", "UTGuiChatMixin", "UTGuiNewChatMixin"] +} \ No newline at end of file