diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-19 12:04:52 -0400 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-19 12:04:52 -0400 |
commit | f2853531873b2a88949535289350a9ed56863eea (patch) | |
tree | f4fbf95061c2a94fbe0927a035584735b3831e62 | |
parent | 22fc506d03d9faf0a0d0a4e5d021b21865ff0dcf (diff) | |
download | SkytilsMod-f2853531873b2a88949535289350a9ed56863eea.tar.gz SkytilsMod-f2853531873b2a88949535289350a9ed56863eea.tar.bz2 SkytilsMod-f2853531873b2a88949535289350a9ed56863eea.zip |
stay mad
5 files changed, 112 insertions, 1 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/accessors/AccessorGuiMainMenu.java b/src/main/java/skytils/skytilsmod/mixins/transformers/accessors/AccessorGuiMainMenu.java new file mode 100644 index 00000000..f203b783 --- /dev/null +++ b/src/main/java/skytils/skytilsmod/mixins/transformers/accessors/AccessorGuiMainMenu.java @@ -0,0 +1,32 @@ +/* + * 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.client.gui.GuiMainMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(GuiMainMenu.class) +public interface AccessorGuiMainMenu { + @Accessor + String getSplashText(); + + @Accessor + void setSplashText(String text); +} diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiMainMenu.java b/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiMainMenu.java new file mode 100644 index 00000000..36e23d03 --- /dev/null +++ b/src/main/java/skytils/skytilsmod/mixins/transformers/gui/MixinGuiMainMenu.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.GuiMainMenu; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiYesNoCallback; +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.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import skytils.skytilsmod.mixins.hooks.gui.GuiMainMenuHookKt; + +import java.util.Calendar; + +@Mixin(GuiMainMenu.class) +public class MixinGuiMainMenu extends GuiScreen implements GuiYesNoCallback { + @Inject(method = "initGui", at = @At(value = "INVOKE", target = "Ljava/util/Calendar;setTime(Ljava/util/Date;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILSOFT) + private void setSplashText(CallbackInfo ci, Calendar calendar) { + GuiMainMenuHookKt.setSplashText((GuiMainMenu)(Object)this, calendar); + } +} diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorJerry.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorJerry.kt index 6c37169a..27c55112 100644 --- a/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorJerry.kt +++ b/src/main/kotlin/skytils/skytilsmod/features/impl/events/MayorJerry.kt @@ -53,7 +53,13 @@ class MayorJerry { ) { val match = jerryType.find(formatted) if (match != null) { - if (Skytils.config.hiddenJerryTimer && lastJerry != -1L) UChat.chat("§bIt has been ${NumberUtil.nf.format((System.currentTimeMillis() - lastJerry) / 1000.0)} seconds since the last Jerry.") + if (Skytils.config.hiddenJerryTimer && lastJerry != -1L) UChat.chat( + "§bIt has been ${ + NumberUtil.nf.format( + (System.currentTimeMillis() - lastJerry) / 1000.0 + ) + } seconds since the last Jerry." + ) lastJerry = System.currentTimeMillis() val color = match.groups[1]!!.value MayorJerryTracker.onJerry("§$color Jerry") diff --git a/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiMainMenuHook.kt b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiMainMenuHook.kt new file mode 100644 index 00000000..bd3d20c8 --- /dev/null +++ b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/gui/GuiMainMenuHook.kt @@ -0,0 +1,32 @@ +/* + * 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.hooks.gui + +import net.minecraft.client.gui.GuiMainMenu +import skytils.skytilsmod.mixins.transformers.accessors.AccessorGuiMainMenu +import skytils.skytilsmod.utils.NumberUtil.addSuffix +import java.util.* + +fun setSplashText(gui: GuiMainMenu, cal: Calendar) { + gui as AccessorGuiMainMenu + if (cal.get(Calendar.MONTH) + 1 == 2 && cal.get(Calendar.DATE) == 5) { + val numBirthday = cal.get(Calendar.YEAR) - 2021 + gui.splashText = "§z§kstay §zHappy ${numBirthday.addSuffix()} Birthday Skytils! §kmadL" + } +}
\ No newline at end of file diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json index 23835052..8684fa3c 100644 --- a/src/main/resources/mixins.skytils.json +++ b/src/main/resources/mixins.skytils.json @@ -28,6 +28,7 @@ "gui.MixinGuiContainer", "gui.MixinGuiIngame", "gui.MixinGuiIngameForge", + "gui.MixinGuiMainMenu", "gui.MixinGuiNewChat", "gui.MixinGuiScreen", "inventory.MixinSlot", @@ -66,6 +67,7 @@ "verbose": true, "client": [ "accessors.AccessorGuiChat", + "accessors.AccessorGuiMainMenu", "neu.MixinCustomAH", "renderer.MixinItemRenderer", "renderer.MixinRendererLivingEntity" |