diff --git a/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java b/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java index 7aed89c..9e215ec 100644 --- a/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java +++ b/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java @@ -6,7 +6,6 @@ import com.minelittlepony.bigpony.BigPony; import com.minelittlepony.bigpony.Scaled; import com.minelittlepony.bigpony.Scaling; -import com.minelittlepony.bigpony.minelittlepony.PresetDetector; import com.minelittlepony.common.client.gui.GameGui; import com.minelittlepony.common.client.gui.ScrollContainer; import com.minelittlepony.common.client.gui.element.AbstractSlider; @@ -128,23 +127,9 @@ private void rebuildContent() { .setTextFormat(format("minebp.camera.distance")) .setEnabled(allowCamera && allowScaling); - Toggle visual; - content.addButton(visual = new Toggle(left, top += 30, !bigPony.isVisual())) + content.addButton(new Toggle(left, top += 30, !bigPony.isVisual())) .onChange(v -> { bigPony.setVisual(!v); - if (v) { - visual.setEnabled(false); - PresetDetector.getInstance().detectPreset(client.getSession().getProfile(), bigPony).handle((skin, ex) -> { - visual.setEnabled(true); - xSize.setValue(bigPony.getScale().x); - ySize.setValue(bigPony.getScale().y); - zSize.setValue(bigPony.getScale().z); - height.setValue(bigPony.getCamera().height); - distance.setValue(bigPony.getCamera().distance); - tick(); - return null; - }); - } tick(); return v; }) diff --git a/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java b/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java deleted file mode 100644 index 412da64..0000000 --- a/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.minelittlepony.bigpony.hdskins; - -import java.util.concurrent.CompletableFuture; - -import com.minelittlepony.bigpony.util.FutureUtils; -import com.minelittlepony.hdskins.client.HDSkins; -import com.minelittlepony.hdskins.profile.SkinType; -import com.mojang.authlib.GameProfile; - -import net.fabricmc.api.ClientModInitializer; -import net.minecraft.client.MinecraftClient; -import net.minecraft.util.Identifier; - -public class Main extends SkinDetecter implements ClientModInitializer { - - @Override - public void onInitializeClient() { - INSTANCE = this; - } - - @Override - public CompletableFuture loadSkin(GameProfile profile) { - return FutureUtils.waitFor(callback -> { - HDSkins.getInstance().getProfileRepository().fetchSkins(profile, (type, texture, payload) -> { - if (type == SkinType.SKIN) { - MinecraftClient.getInstance().executeTask(() -> callback.accept(texture)); - } - }); - }, () -> null).thenCompose(value -> value == null ? super.loadSkin(profile) : CompletableFuture.completedFuture(value)); - } -} diff --git a/src/main/java/com/minelittlepony/bigpony/hdskins/SkinDetecter.java b/src/main/java/com/minelittlepony/bigpony/hdskins/SkinDetecter.java deleted file mode 100644 index 63200a3..0000000 --- a/src/main/java/com/minelittlepony/bigpony/hdskins/SkinDetecter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.minelittlepony.bigpony.hdskins; - -import java.util.concurrent.CompletableFuture; - -import com.minelittlepony.bigpony.util.FutureUtils; -import com.mojang.authlib.GameProfile; -import net.minecraft.client.MinecraftClient; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import net.minecraft.client.util.DefaultSkinHelper; -import net.minecraft.util.Identifier; - -public class SkinDetecter { - static SkinDetecter INSTANCE = new SkinDetecter(); - - public static SkinDetecter getInstance() { - return INSTANCE; - } - - SkinDetecter() {} - - public CompletableFuture loadSkin(GameProfile profile) { - return FutureUtils.waitFor(callback -> { - MinecraftClient.getInstance().getSkinProvider().loadSkin(profile, (type, texture, payload) -> { - if (type == MinecraftProfileTexture.Type.SKIN) { - MinecraftClient.getInstance().executeTask(() -> callback.accept(texture)); - } - }, false); - }, () -> DefaultSkinHelper.getTexture(profile.getId())); - } -} diff --git a/src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java b/src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java index ed7560f..a7c3737 100644 --- a/src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java +++ b/src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java @@ -1,24 +1,16 @@ package com.minelittlepony.bigpony.minelittlepony; import com.minelittlepony.api.pony.IPony; -import com.minelittlepony.api.pony.IPonyData; import com.minelittlepony.api.pony.meta.Size; import com.minelittlepony.api.pony.network.fabric.PonyDataCallback; import com.minelittlepony.bigpony.*; import com.minelittlepony.bigpony.client.BigPonyClient; -import com.minelittlepony.bigpony.hdskins.SkinDetecter; -import com.mojang.authlib.GameProfile; - -import java.util.concurrent.CompletableFuture; - import com.minelittlepony.api.config.PonyConfig; import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; -import net.minecraft.client.MinecraftClient; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Identifier; public class Main extends PresetDetector implements ClientModInitializer { @@ -35,7 +27,13 @@ public void onInitializeClient() { if (!BigPony.getInstance().getScaling().isVisual() && env == EnvType.CLIENT && BigPonyClient.isClientPlayer(sender)) { - applyPreset(IPony.getManager().getPony(sender).metadata(), ((Scaled)sender).getScaling()); + Scaling into = ((Scaled)sender).getScaling(); + Size size = data.getSize(); + boolean fillyCam = PonyConfig.getInstance().fillycam.get(); + PonyConfig.getInstance().fillycam.set(true); + into.setScale(new Triple(size.getScaleFactor())); + into.setCamera(new Cam(size.getEyeDistanceFactor(), size.getEyeHeightFactor())); + PonyConfig.getInstance().fillycam.set(fillyCam); } }); } @@ -49,21 +47,4 @@ public boolean isFillyCam() { public boolean isPony(PlayerEntity player) { return !IPony.getManager().getPony(player).race().isHuman(); } - - @Override - public CompletableFuture detectPreset(GameProfile profile, Scaling into) { - return SkinDetecter.getInstance().loadSkin(profile).thenApplyAsync(skin -> { - applyPreset(IPony.getManager().getPony(skin).metadata(), into); - return skin; - }, MinecraftClient.getInstance()); - } - - private void applyPreset(IPonyData data, Scaling into) { - Size size = data.getSize(); - boolean fillyCam = PonyConfig.getInstance().fillycam.get(); - PonyConfig.getInstance().fillycam.set(true); - into.setScale(new Triple(size.getScaleFactor())); - into.setCamera(new Cam(size.getEyeDistanceFactor(), size.getEyeHeightFactor())); - PonyConfig.getInstance().fillycam.set(fillyCam); - } } diff --git a/src/main/java/com/minelittlepony/bigpony/minelittlepony/PresetDetector.java b/src/main/java/com/minelittlepony/bigpony/minelittlepony/PresetDetector.java index 32041b6..b20460e 100644 --- a/src/main/java/com/minelittlepony/bigpony/minelittlepony/PresetDetector.java +++ b/src/main/java/com/minelittlepony/bigpony/minelittlepony/PresetDetector.java @@ -1,12 +1,6 @@ package com.minelittlepony.bigpony.minelittlepony; -import java.util.concurrent.CompletableFuture; - -import com.minelittlepony.bigpony.Scaling; -import com.mojang.authlib.GameProfile; - import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Identifier; public class PresetDetector { static PresetDetector INSTANCE = new PresetDetector(); @@ -24,8 +18,4 @@ public boolean isFillyCam() { public boolean isPony(PlayerEntity player) { return false; } - - public CompletableFuture detectPreset(GameProfile profile, Scaling into) { - return CompletableFuture.failedFuture(null); - } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 57d14ee..7fb0485 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,9 +26,6 @@ ], "minelittlepony": [ "com.minelittlepony.bigpony.minelittlepony.Main" - ], - "hdskins": [ - "com.minelittlepony.bigpony.hdskins.Main" ] }, "mixins": [ @@ -47,8 +44,11 @@ "custom": { "modmenu": { "links": { - "modmenu.discord": "https://discord.gg/zKSZ8Mg" - } + "modmenu.discord": "https://discord.gg/zKSZ8Mg", + "modmenu.github_releases": "https://github.com/MineLittlePony/BigPony/releases", + "modmenu.modrinth": "https://modrinth.com/mod/big-pony" + }, + "update_checker": true } } }