From df9d2fbe2fcd427cbec30a781cfd49ee644cdca3 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 2 Aug 2023 22:08:01 -0400 Subject: [PATCH 1/4] Remove default impl from ModernFixPlatformHooks --- .../platform/ModernFixPlatformHooks.java | 88 ++++--------------- 1 file changed, 19 insertions(+), 69 deletions(-) diff --git a/common/src/main/java/org/embeddedt/modernfix/platform/ModernFixPlatformHooks.java b/common/src/main/java/org/embeddedt/modernfix/platform/ModernFixPlatformHooks.java index 0a89c5f8..9fc41e05 100644 --- a/common/src/main/java/org/embeddedt/modernfix/platform/ModernFixPlatformHooks.java +++ b/common/src/main/java/org/embeddedt/modernfix/platform/ModernFixPlatformHooks.java @@ -18,92 +18,42 @@ import java.util.function.Consumer; public interface ModernFixPlatformHooks { ModernFixPlatformHooks INSTANCE = PlatformHookLoader.findInstance(); - default boolean isClient() { - throw new AssertionError(); - } - + boolean isClient(); - default boolean isDedicatedServer() { - throw new AssertionError(); - } - + boolean isDedicatedServer(); - default String getVersionString() { - throw new AssertionError(); - } + String getVersionString(); + boolean modPresent(String modId); - default boolean modPresent(String modId) { - throw new AssertionError(); - } + boolean isDevEnv(); - - default boolean isDevEnv() { - throw new AssertionError(); - } + void injectPlatformSpecificHacks(); - - default void injectPlatformSpecificHacks() { - throw new AssertionError(); - } + void applyASMTransformers(String mixinClassName, ClassNode targetClass); - - default void applyASMTransformers(String mixinClassName, ClassNode targetClass) { - throw new AssertionError(); - } + MinecraftServer getCurrentServer(); - - default MinecraftServer getCurrentServer() { - throw new AssertionError(); - } + boolean isEarlyLoadingNormally(); - - default boolean isEarlyLoadingNormally() { - throw new AssertionError(); - } + boolean isLoadingNormally(); - - default boolean isLoadingNormally() { - throw new AssertionError(); - } - - - default TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture, + TextureAtlasSprite loadTextureAtlasSprite(TextureAtlas atlasTexture, ResourceManager resourceManager, TextureAtlasSprite.Info textureInfo, Resource resource, int atlasWidth, int atlasHeight, int spriteX, int spriteY, int mipmapLevel, - NativeImage image) { - throw new AssertionError(); - } + NativeImage image); + Path getGameDirectory(); + + void sendPacket(ServerPlayer player, Object packet); - default Path getGameDirectory() { - throw new AssertionError(); - } + void onServerCommandRegister(Consumer> handler); - - default void sendPacket(ServerPlayer player, Object packet) { - throw new AssertionError(); - } + Multimap getCustomModOptions(); - - default void onServerCommandRegister(Consumer> handler) { - throw new AssertionError(); - } + void onLaunchComplete(); - - default Multimap getCustomModOptions() { - throw new AssertionError(); - } - - - default void onLaunchComplete() { - - } - - - default String getPlatformName() { - throw new AssertionError(); - } + String getPlatformName(); } From 24792b96ccc38187b1755aaafcc161c813277d59 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:27:32 -0400 Subject: [PATCH 2/4] Move ModernFix branding to right side of screen --- .../mixin/feature/branding/GuiMixin.java | 11 +++++---- .../forge/init/ModernFixClientForge.java | 23 +++++++++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/feature/branding/GuiMixin.java b/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/feature/branding/GuiMixin.java index 61264955..64ac1037 100644 --- a/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/feature/branding/GuiMixin.java +++ b/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/feature/branding/GuiMixin.java @@ -4,15 +4,16 @@ import net.minecraft.client.gui.components.DebugScreenOverlay; import org.embeddedt.modernfix.ModernFixClientFabric; 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; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import java.util.List; @Mixin(DebugScreenOverlay.class) public class GuiMixin { - @Inject(method = "getGameInformation", at = @At("RETURN")) - private void addModernFix(CallbackInfoReturnable> cir) { - cir.getReturnValue().add(ModernFixClientFabric.commonMod.brandingString); + @ModifyVariable(method = "getSystemInformation", at = @At("STORE"), ordinal = 0, require = 0) + private List addModernFix(List list) { + list.add(""); + list.add(ModernFixClientFabric.commonMod.brandingString); + return list; } } diff --git a/forge/src/main/java/org/embeddedt/modernfix/forge/init/ModernFixClientForge.java b/forge/src/main/java/org/embeddedt/modernfix/forge/init/ModernFixClientForge.java index 0852428d..05b901b0 100644 --- a/forge/src/main/java/org/embeddedt/modernfix/forge/init/ModernFixClientForge.java +++ b/forge/src/main/java/org/embeddedt/modernfix/forge/init/ModernFixClientForge.java @@ -23,6 +23,9 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.embeddedt.modernfix.ModernFixClient; import org.embeddedt.modernfix.screen.ModernFixConfigScreen; +import java.util.ArrayList; +import java.util.List; + public class ModernFixClientForge { private static ModernFixClient commonMod; @@ -50,11 +53,27 @@ public class ModernFixClientForge { } } + private static final List brandingList = new ArrayList<>(); + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderOverlay(RenderGameOverlayEvent.Text event) { if(commonMod.brandingString != null && Minecraft.getInstance().options.renderDebug) { - event.getLeft().add(""); - event.getLeft().add(commonMod.brandingString); + if(brandingList.size() == 0) { + brandingList.add(""); + brandingList.add(commonMod.brandingString); + } + int targetIdx = 0, numSeenBlanks = 0; + List right = event.getRight(); + while(targetIdx < right.size()) { + String s = right.get(targetIdx); + if(s == null || s.length() == 0) { + numSeenBlanks++; + } + if(numSeenBlanks == 3) + break; + targetIdx++; + } + right.addAll(targetIdx, brandingList); } } From ac827a0f42ea145c40d316b9e3cef1d70bbdd840 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:29:04 -0400 Subject: [PATCH 3/4] Fix branch list including dev branches --- scripts/branchlist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/branchlist.sh b/scripts/branchlist.sh index e6c5de00..eee6170f 100755 --- a/scripts/branchlist.sh +++ b/scripts/branchlist.sh @@ -1,2 +1,2 @@ #!/bin/bash -git ls-remote --heads origin | awk '{print $2}' | sed 's:.*/::' | sort -V | grep -E '^1\.[0-9]*(\.[0-9]*)?$' +git ls-remote --heads origin | awk '{print $2}' | grep -E '^refs/heads/1\.' | sed 's:.*/::' | sort -V | grep -E '^1\.[0-9]*(\.[0-9]*)?$' From 81ebcc81862d7df2de9b50b3eb8a28c430d3b06a Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:53:49 -0400 Subject: [PATCH 4/4] Link to wiki changelog --- build.gradle | 10 ++++++---- gradle/changelog.mustache | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index c971d173..504afca9 100644 --- a/build.gradle +++ b/build.gradle @@ -166,17 +166,19 @@ tasks.withType(JavaCompile) { task generateChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) { def details = versionDetails(); + def theVersionRef if(details.commitDistance > 0) { - fromRef = details.lastTag; + theVersionRef = details.lastTag; } else { def secondLastTagCmd = "git describe --abbrev=0 " + details.lastTag + "^" def secondLastTag = secondLastTagCmd.execute().text.trim() - fromRef = secondLastTag; + theVersionRef = secondLastTag; } + fromRef = theVersionRef + file = new File("CHANGELOG.md"); - def otherTemplateContent = new File('gradle/changelog.mustache').getText('UTF-8'); - templateContent = "## Changes since " + fromRef + "\n" + otherTemplateContent; + templateContent = new File('gradle/changelog.mustache').getText('UTF-8').replace("[[modernFixVersionRef]]", theVersionRef); toCommit = "HEAD"; } diff --git a/gradle/changelog.mustache b/gradle/changelog.mustache index b3175640..b46ec636 100644 --- a/gradle/changelog.mustache +++ b/gradle/changelog.mustache @@ -1,3 +1,7 @@ +Depending on the size of this release, there may be a human-readable changelog available on [the wiki page](https://github.com/embeddedt/ModernFix/wiki/Changelog). + +## Changes since [[modernFixVersionRef]] + {{#commits}} {{#ifMatches messageTitle "^(?!Merge).*"}} * [{{{messageTitle}}}](https://github.com/embeddedt/ModernFix/commit/{{hashFull}}) - {{{authorName}}}