aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-07-31 00:48:15 +0200
committernea <nea@nea.moe>2023-07-31 00:48:15 +0200
commite6e3f4a496bfff99bce3aa4469e74f29b3daab12 (patch)
tree0d85db5212f1c630a7c5506e51f304dd8f547dae /src/main
parentdbc56fb352134839800fad2a9d71dce6ab67349a (diff)
downloadfirmament-e6e3f4a496bfff99bce3aa4469e74f29b3daab12.tar.gz
firmament-e6e3f4a496bfff99bce3aa4469e74f29b3daab12.tar.bz2
firmament-e6e3f4a496bfff99bce3aa4469e74f29b3daab12.zip
Add skin fixer
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java18
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/FeatureManager.kt2
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/fixes/Fixes.kt16
-rw-r--r--src/main/kotlin/moe/nea/firmament/repo/ItemCache.kt1
4 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java b/src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java
new file mode 100644
index 0000000..c858db1
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MixinPlayerListEntry.java
@@ -0,0 +1,18 @@
+package moe.nea.firmament.mixins;
+
+import moe.nea.firmament.features.fixes.Fixes;
+import net.minecraft.client.network.PlayerListEntry;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.ModifyArg;
+
+@Mixin(PlayerListEntry.class)
+public class MixinPlayerListEntry {
+ @ModifyArg(method = "loadTextures", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/PlayerSkinProvider;loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V"))
+ public boolean shouldBeSecure(boolean originalSecure) {
+ if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {
+ return false;
+ }
+ return originalSecure;
+ }
+}
diff --git a/src/main/kotlin/moe/nea/firmament/features/FeatureManager.kt b/src/main/kotlin/moe/nea/firmament/features/FeatureManager.kt
index 96222da..416da18 100644
--- a/src/main/kotlin/moe/nea/firmament/features/FeatureManager.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/FeatureManager.kt
@@ -25,6 +25,7 @@ import moe.nea.firmament.features.chat.ImagePreview
import moe.nea.firmament.features.debug.DebugView
import moe.nea.firmament.features.debug.DeveloperFeatures
import moe.nea.firmament.features.fishing.FishingWarning
+import moe.nea.firmament.features.fixes.Fixes
import moe.nea.firmament.features.inventory.CraftingOverlay
import moe.nea.firmament.features.inventory.SaveCursorPosition
import moe.nea.firmament.features.inventory.SlotLocking
@@ -60,6 +61,7 @@ object FeatureManager : DataHolder<FeatureManager.Config>(serializer(), "feature
loadFeature(ImagePreview)
loadFeature(SaveCursorPosition)
loadFeature(CustomSkyBlockTextures)
+ loadFeature(Fixes)
if (Firmament.DEBUG) {
loadFeature(DeveloperFeatures)
loadFeature(DebugView)
diff --git a/src/main/kotlin/moe/nea/firmament/features/fixes/Fixes.kt b/src/main/kotlin/moe/nea/firmament/features/fixes/Fixes.kt
new file mode 100644
index 0000000..82cb37f
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/features/fixes/Fixes.kt
@@ -0,0 +1,16 @@
+package moe.nea.firmament.features.fixes
+
+import moe.nea.firmament.features.FirmamentFeature
+import moe.nea.firmament.gui.config.ManagedConfig
+
+object Fixes : FirmamentFeature {
+ override val identifier: String
+ get() = "fixes"
+
+ object TConfig : ManagedConfig(identifier) {
+ val fixUnsignedPlayerSkins by toggle("player-skins") { true }
+ }
+
+ override fun onLoad() {
+ }
+}
diff --git a/src/main/kotlin/moe/nea/firmament/repo/ItemCache.kt b/src/main/kotlin/moe/nea/firmament/repo/ItemCache.kt
index 72a779c..5dc1b25 100644
--- a/src/main/kotlin/moe/nea/firmament/repo/ItemCache.kt
+++ b/src/main/kotlin/moe/nea/firmament/repo/ItemCache.kt
@@ -34,6 +34,7 @@ import kotlinx.coroutines.launch
import net.minecraft.SharedConstants
import net.minecraft.block.entity.SkullBlockEntity
import net.minecraft.client.resource.language.I18n
+import net.minecraft.client.texture.PlayerSkinProvider
import net.minecraft.datafixer.Schemas
import net.minecraft.datafixer.TypeReferences
import net.minecraft.item.ItemStack