From d228323c14f329f8ac40a2bbd5258cf371a8755f Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 11 Mar 2024 11:22:51 +0000 Subject: [PATCH 1/4] 1.20.2 -> 1.20.1 --- gradle.properties | 18 +++++++------- .../bigpony/client/gui/GuiBigSettings.java | 2 +- .../minelittlepony/bigpony/hdskins/Main.java | 15 ++++++------ .../bigpony/hdskins/SkinDetecter.java | 13 ++++++---- .../bigpony/minelittlepony/Main.java | 24 +++++++++---------- 5 files changed, 38 insertions(+), 34 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9b02758..a955ab2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon=false # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.20.2-rc1 - yarn_mappings=1.20.2-rc1+build.2 - loader_version=0.14.22 - fabric_version=0.88.5+1.20.2 + minecraft_version=1.20.1 + yarn_mappings=1.20.1+build.10 + loader_version=0.15.3 + fabric_version=0.91.0+1.20.1 # Mod Properties group=com.minelittlepony @@ -15,12 +15,12 @@ org.gradle.daemon=false description=Ah am a big pony! # Publishing - minecraft_version_range=>=1.20.2 + minecraft_version_range=1.20.1 modrinth_loader_type=fabric modrinth_project_id=h9pJxJR9 # Dependencies - modmenu_version=8.0.0-beta.1 - kirin_version=1.16.0+1.20.2 - hd_skins_version=6.11.1+1.20.2 - minelp_version=4.11.0+1.20.2 + modmenu_version=7.0.0-beta.2 + kirin_version=1.15.4+1.20 + hd_skins_version=6.10.3+1.20 + minelp_version=4.10.4+1.20.1 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 c4b3b8d..a0d167b 100644 --- a/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java +++ b/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java @@ -134,7 +134,7 @@ private void rebuildContent() { bigPony.setVisual(!v); if (v) { visual.setEnabled(false); - PresetDetector.getInstance().detectPreset(client.getGameProfile(), bigPony).handle((skin, ex) -> { + PresetDetector.getInstance().detectPreset(client.getSession().getProfile(), bigPony).handle((skin, ex) -> { visual.setEnabled(true); xSize.setValue(bigPony.getScale().x); ySize.setValue(bigPony.getScale().y); diff --git a/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java b/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java index 0234796..412da64 100644 --- a/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java +++ b/src/main/java/com/minelittlepony/bigpony/hdskins/Main.java @@ -1,6 +1,5 @@ package com.minelittlepony.bigpony.hdskins; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import com.minelittlepony.bigpony.util.FutureUtils; @@ -9,6 +8,7 @@ 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 { @@ -20,11 +20,12 @@ public void onInitializeClient() { @Override public CompletableFuture loadSkin(GameProfile profile) { - return FutureUtils.>either( - HDSkins.getInstance().getProfileRepository().load(profile).thenApply(skins -> { - return skins.getSkin(SkinType.SKIN); - }), - Optional::empty - ).thenCompose(value -> value.map(CompletableFuture::completedFuture).orElseGet(() -> super.loadSkin(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 index 718040d..63200a3 100644 --- a/src/main/java/com/minelittlepony/bigpony/hdskins/SkinDetecter.java +++ b/src/main/java/com/minelittlepony/bigpony/hdskins/SkinDetecter.java @@ -5,8 +5,8 @@ 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.client.util.SkinTextures; import net.minecraft.util.Identifier; public class SkinDetecter { @@ -19,9 +19,12 @@ public static SkinDetecter getInstance() { SkinDetecter() {} public CompletableFuture loadSkin(GameProfile profile) { - return FutureUtils.either( - MinecraftClient.getInstance().getSkinProvider().fetchSkinTextures(profile), - () -> DefaultSkinHelper.getTexture(profile.getId()) - ).thenApply(SkinTextures::texture); + 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 8b065b6..a74b824 100644 --- a/src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java +++ b/src/main/java/com/minelittlepony/bigpony/minelittlepony/Main.java @@ -1,7 +1,8 @@ package com.minelittlepony.bigpony.minelittlepony; -import com.minelittlepony.api.pony.Pony; +import com.minelittlepony.api.pony.IPony; 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; @@ -9,11 +10,10 @@ import java.util.concurrent.CompletableFuture; -import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.api.config.PonyConfig; -import com.minelittlepony.api.events.PonyDataCallback; -import com.minelittlepony.api.events.PonyModelPrepareCallback; +import com.minelittlepony.api.model.IModel; import com.minelittlepony.api.model.ModelAttributes; +import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; @@ -29,7 +29,7 @@ public void onInitializeClient() { INSTANCE = this; PonyModelPrepareCallback.EVENT.register(this::onPonyModelPrepared); - PonyDataCallback.EVENT.register((sender, data, env) -> { + PonyDataCallback.EVENT.register((sender, data, noSkin, env) -> { if (!BigPony.getInstance().getScaling().isVisual() && env == EnvType.CLIENT && BigPonyClient.isClientPlayer(sender)) { @@ -38,9 +38,9 @@ public void onInitializeClient() { }); } - private void onPonyModelPrepared(Entity entity, PonyModel model, ModelAttributes.Mode mode) { + private void onPonyModelPrepared(Entity entity, IModel model, ModelAttributes.Mode mode) { if (entity instanceof Scaled && !((Scaled)entity).getScaling().isVisual() && isPony((PlayerEntity)entity)) { - model.getAttributes().visualHeight = entity.getHeight() / model.getSize().scaleFactor(); + model.getAttributes().visualHeight = entity.getHeight() / model.getSize().getScaleFactor(); } } @@ -51,7 +51,7 @@ public boolean isFillyCam() { @Override public boolean isPony(PlayerEntity player) { - return !Pony.getManager().getPony(player).race().isHuman(); + return !IPony.getManager().getPony(player).race().isHuman(); } @Override @@ -60,11 +60,11 @@ public CompletableFuture detectPreset(GameProfile profile, Scaling i // Turn on filly cam so we can get the camera parameters PonyConfig.getInstance().fillycam.set(true); - Pony pony = Pony.getManager().getPony(skin); - Size size = pony.metadata().size(); + IPony pony = IPony.getManager().getPony(skin); + Size size = pony.metadata().getSize(); - into.setScale(new Triple(size.scaleFactor())); - into.setCamera(new Cam(size.eyeDistanceFactor(), size.eyeHeightFactor())); + into.setScale(new Triple(size.getScaleFactor())); + into.setCamera(new Cam(size.getEyeDistanceFactor(), size.getEyeHeightFactor())); // We turn off filly cam because it's not needed and might cause issues with buckets if left enabled PonyConfig.getInstance().fillycam.set(false); From cc44666439c6690a3920ab5922a672e6e02f64a8 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 11 Mar 2024 11:26:48 +0000 Subject: [PATCH 2/4] Fix keybind --- .../java/com/minelittlepony/bigpony/client/BigPonyClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minelittlepony/bigpony/client/BigPonyClient.java b/src/main/java/com/minelittlepony/bigpony/client/BigPonyClient.java index 558d228..cfb427f 100644 --- a/src/main/java/com/minelittlepony/bigpony/client/BigPonyClient.java +++ b/src/main/java/com/minelittlepony/bigpony/client/BigPonyClient.java @@ -19,7 +19,7 @@ public class BigPonyClient implements ClientModInitializer { private static BigPonyClient instance; - private KeyBinding keybind = new KeyBinding("key.category.misc", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_F10, "bigpony:settings"); + private KeyBinding keybind; public static BigPonyClient getInstance() { return instance; @@ -35,7 +35,7 @@ public BigPonyClient() { @Override public void onInitializeClient() { - KeyBindingHelper.registerKeyBinding(keybind); + keybind = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.minebp.settings", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_F8, KeyBinding.MISC_CATEGORY)); ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick); } From 7a1111a2caeec6c4eb6c9413051bb3c72b4a3f73 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 11 Mar 2024 12:06:22 +0000 Subject: [PATCH 3/4] Fix menu background --- .../com/minelittlepony/bigpony/client/gui/GuiBigSettings.java | 1 + 1 file changed, 1 insertion(+) 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 a0d167b..7aed89c 100644 --- a/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java +++ b/src/main/java/com/minelittlepony/bigpony/client/gui/GuiBigSettings.java @@ -172,6 +172,7 @@ static Function, Text> format(String key) { @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + renderBackground(context); super.render(context, mouseX, mouseY, partialTicks); content.render(context, mouseX, mouseY, partialTicks); } From 3609ff50bad045b380155cbbe056bd39b04cd11a Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 11 Mar 2024 12:11:11 +0000 Subject: [PATCH 4/4] Update modrinth tags --- build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index c4d1499..11e1167 100644 --- a/build.gradle +++ b/build.gradle @@ -93,8 +93,10 @@ modrinth { gameVersions.add ver } dependencies { - required.project 'P7dR8mSH' - optional.project 'JBjInUXM' + required.project 'P7dR8mSH' //fabric-api + optional.project 'JBjInUXM' //minelp + optional.project 'FzE9gshV' //hdskins + embedded.project '9aNz8Zqn' //kirin } }