diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-06-12 03:14:24 -0400 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-06-12 03:14:24 -0400 |
commit | 0cf5785fa2fc01e1f7361c9c9263453f38cc52be (patch) | |
tree | 939bb953b61423b81038db482bfeab3a81022db7 /src/main | |
parent | ed756e52e53d1b01c1935f39d5e08505b49b2c2a (diff) | |
download | SkytilsMod-0cf5785fa2fc01e1f7361c9c9263453f38cc52be.tar.gz SkytilsMod-0cf5785fa2fc01e1f7361c9c9263453f38cc52be.tar.bz2 SkytilsMod-0cf5785fa2fc01e1f7361c9c9263453f38cc52be.zip |
We only make the most useful stuff here at Skytils
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/skytils/skytilsmod/mixins/entity/MixinAbstractClientPlayer.java | 78 | ||||
-rw-r--r-- | src/main/kotlin/skytils/skytilsmod/Skytils.kt | 10 | ||||
-rw-r--r-- | src/main/kotlin/skytils/skytilsmod/gui/OptionsGui.kt | 2 | ||||
-rw-r--r-- | src/main/resources/assets/skytils/sychicskin.png | bin | 0 -> 1791 bytes | |||
-rw-r--r-- | src/main/resources/mixins.skytils.json | 1 |
5 files changed, 84 insertions, 7 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/entity/MixinAbstractClientPlayer.java b/src/main/java/skytils/skytilsmod/mixins/entity/MixinAbstractClientPlayer.java new file mode 100644 index 00000000..bedc32fa --- /dev/null +++ b/src/main/java/skytils/skytilsmod/mixins/entity/MixinAbstractClientPlayer.java @@ -0,0 +1,78 @@ +/* + * 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.entity; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import kotlin.collections.CollectionsKt; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import org.apache.commons.codec.binary.Base64; +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 skytils.skytilsmod.utils.Utils; + +@Mixin(AbstractClientPlayer.class) +public abstract class MixinAbstractClientPlayer extends EntityPlayer { + public MixinAbstractClientPlayer(World worldIn, GameProfile gameProfileIn) { + super(worldIn, gameProfileIn); + } + + private static final ResourceLocation sychicSkin = new ResourceLocation("skytils:sychicskin.png"); + private static final String phoenixSkinObject = "eyJ0aW1lc3RhbXAiOjE1NzU0NzAyNzE3MTUsInByb2ZpbGVJZCI6ImRlNTcxYTEwMmNiODQ4ODA4ZmU3YzlmNDQ5NmVjZGFkIiwicHJvZmlsZU5hbWUiOiJNSEZfTWluZXNraW4iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzM2YTAzODNhNTI3ODAzZDk5YjY2MmFkMThiY2FjNzhjMTE5MjUwZWJiZmIxNDQ3NWI0ZWI0ZDRhNjYyNzk2YjQifX19"; + + private Boolean isSummonMob = null; + + @Inject(method = "getLocationSkin()Lnet/minecraft/util/ResourceLocation;", at = @At("RETURN"), cancellable = true) + private void replaceSkin(CallbackInfoReturnable<ResourceLocation> cir) { + if (isSummonMob()) cir.setReturnValue(sychicSkin); + } + + @Inject(method = "hasSkin", at = @At("RETURN"), cancellable = true) + private void replaceHasSkin(CallbackInfoReturnable<Boolean> cir) { + if (isSummonMob()) cir.setReturnValue(true); + } + + @Inject(method = "getSkinType", at = @At("RETURN"), cancellable = true) + private void replaceSkinType(CallbackInfoReturnable<String> cir) { + if (isSummonMob()) cir.setReturnValue("slim"); + } + + private boolean isSummonMob() { + if (!Utils.inSkyblock) return false; + try { + if (isSummonMob == null) { + if ("Lost Adventurer".equals(this.getName())) { + Property textures = CollectionsKt.firstOrNull(this.getGameProfile().getProperties().get("textures")); + if (textures != null) { + isSummonMob = phoenixSkinObject.equals(textures.getValue()); + } + } + } + } catch(Exception e) { + isSummonMob = false; + } + if (isSummonMob == null) isSummonMob = false; + return isSummonMob; + } +} diff --git a/src/main/kotlin/skytils/skytilsmod/Skytils.kt b/src/main/kotlin/skytils/skytilsmod/Skytils.kt index 9eb61a23..acc1cae0 100644 --- a/src/main/kotlin/skytils/skytilsmod/Skytils.kt +++ b/src/main/kotlin/skytils/skytilsmod/Skytils.kt @@ -137,12 +137,9 @@ class Skytils { @Mod.EventHandler fun preInit(event: FMLPreInitializationEvent) { // Must use reflection otherwise the "constant" value will be inlined by compiler - val forgeVersion = try { + val forgeVersion = runCatching { ForgeVersion::class.java.getDeclaredField("buildVersion").get(null) as Int - } catch (e: Exception) { - e.printStackTrace() - 2318 - } + }.onFailure { it.printStackTrace() }.getOrDefault(2318) // Asbyth's forge fork uses version 0 if (!(forgeVersion >= 2318 || forgeVersion == 0)) { Desktop.getDesktop() @@ -236,10 +233,9 @@ class Skytils { usingNEU = Loader.isModLoaded("notenoughupdates") if (usingDungeonRooms && Loader.instance().indexedModList["dungeonrooms"]!!.version.startsWith("2")) { - try { + runCatching { ScoreCalculation.drmRoomScanMethod = Class.forName("io.github.quantizr.utils.Utils").getDeclaredMethod("roomList") - } catch (_: Exception) { } } diff --git a/src/main/kotlin/skytils/skytilsmod/gui/OptionsGui.kt b/src/main/kotlin/skytils/skytilsmod/gui/OptionsGui.kt index a0583457..2516def1 100644 --- a/src/main/kotlin/skytils/skytilsmod/gui/OptionsGui.kt +++ b/src/main/kotlin/skytils/skytilsmod/gui/OptionsGui.kt @@ -26,6 +26,7 @@ import gg.essential.elementa.dsl.animate import gg.essential.elementa.dsl.childOf import gg.essential.elementa.dsl.constrain import gg.essential.elementa.dsl.pixels +import gg.essential.elementa.font.DefaultFonts import gg.essential.vigilance.VigilanceConfig import skytils.skytilsmod.Skytils import skytils.skytilsmod.gui.commandaliases.CommandAliasesGui @@ -105,6 +106,7 @@ class OptionsGui : WindowScreen(newGuiScale = 2) { x = CenterConstraint() y = (window.getHeight() / 4 - 75).pixels() textScale = 12.5.pixels() + fontProvider = DefaultFonts.JETBRAINS_MONO_FONT_RENDERER } } diff --git a/src/main/resources/assets/skytils/sychicskin.png b/src/main/resources/assets/skytils/sychicskin.png Binary files differnew file mode 100644 index 00000000..138bc1f8 --- /dev/null +++ b/src/main/resources/assets/skytils/sychicskin.png diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json index 161d0d60..903b61ee 100644 --- a/src/main/resources/mixins.skytils.json +++ b/src/main/resources/mixins.skytils.json @@ -15,6 +15,7 @@ "accessors.AccessorSettingsGui", "audio.MixinSoundManager", "crash.MixinCrashReport", + "entity.MixinAbstractClientPlayer", "entity.MixinBossStatus", "entity.MixinEntityBlaze", "entity.MixinEntityLivingBase", |