diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-08-15 19:27:38 -0400 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-08-15 19:27:38 -0400 |
commit | 60749f1cf26a1651b1e3b7a5b8dec90e938bc3ac (patch) | |
tree | 627d4e82a7e1b6da0c716189c2ce8404b4842e96 /src/main | |
parent | b5c5069917216d8325e3221f86be8f541e3117d7 (diff) | |
download | SkytilsMod-60749f1cf26a1651b1e3b7a5b8dec90e938bc3ac.tar.gz SkytilsMod-60749f1cf26a1651b1e3b7a5b8dec90e938bc3ac.tar.bz2 SkytilsMod-60749f1cf26a1651b1e3b7a5b8dec90e938bc3ac.zip |
TimeChanger Revamp is clearly the best mod for time changing
Diffstat (limited to 'src/main')
4 files changed, 71 insertions, 1 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/accessors/AccessorWorldInfo.java b/src/main/java/skytils/skytilsmod/mixins/transformers/accessors/AccessorWorldInfo.java new file mode 100644 index 00000000..77105880 --- /dev/null +++ b/src/main/java/skytils/skytilsmod/mixins/transformers/accessors/AccessorWorldInfo.java @@ -0,0 +1,29 @@ +/* + * Skytils - Hypixel Skyblock Quality of Life Mod + * Copyright (C) 2021 Skytils + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package skytils.skytilsmod.mixins.transformers.accessors; + +import net.minecraft.world.storage.WorldInfo; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(WorldInfo.class) +public interface AccessorWorldInfo { + @Accessor("worldTime") + long getRealWorldTime(); +} diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiNewChat.java b/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiNewChat.java index 2306c687..1136e0a6 100644 --- a/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiNewChat.java +++ b/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiNewChat.java @@ -26,7 +26,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(value = GuiNewChat.class, priority = 999) -public class MixinGuiNewChat extends Gui { +public abstract class MixinGuiNewChat extends Gui { @Redirect(method = "printChatMessageWithOptionalDeletion", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IChatComponent;getUnformattedText()Ljava/lang/String;")) private String printFormattedText(IChatComponent iChatComponent) { return iChatComponent.getFormattedText(); diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiOverlayDebug.java b/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiOverlayDebug.java new file mode 100644 index 00000000..ce761035 --- /dev/null +++ b/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiOverlayDebug.java @@ -0,0 +1,39 @@ +/* + * Skytils - Hypixel Skyblock Quality of Life Mod + * Copyright (C) 2021 Skytils + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package skytils.skytilsmod.mixins.transformers.gui; + +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiOverlayDebug; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; +import skytils.skytilsmod.mixins.transformers.accessors.AccessorWorldInfo; + +import static skytils.skytilsmod.Skytils.getMc; + +@Mixin(GuiOverlayDebug.class) +public class MixinGuiOverlayDebug extends Gui { + @ModifyArgs(method = "call", at = @At(value = "INVOKE", target = "Ljava/lang/String;format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", remap = false)) + private void returnRealWorldTime(Args args) { + if (args.get(0).equals("Local Difficulty: %.2f (Day %d)")) { + args.set(2, ((AccessorWorldInfo)getMc().theWorld.getWorldInfo()).getRealWorldTime()); + } + } +} diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json index edf40766..3b3aa7bc 100644 --- a/src/main/resources/mixins.skytils.json +++ b/src/main/resources/mixins.skytils.json @@ -14,6 +14,7 @@ "accessors.AccessorMinecraft", "accessors.AccessorRenderItem", "accessors.AccessorSettingsGui", + "accessors.AccessorWorldInfo", "audio.MixinSoundManager", "crash.MixinCrashReport", "entity.MixinAbstractClientPlayer", @@ -26,6 +27,7 @@ "gui.MixinGuiIngame", "gui.MixinGuiIngameForge", "gui.MixinGuiNewChat", + "gui.MixinGuiOverlayDebug", "gui.MixinGuiScreen", "inventory.MixinSlot", "item.MixinItemArmor", |