Skip to content

Commit

Permalink
Use cicadia lib for dummies
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 committed Jun 29, 2024
1 parent 81d6e54 commit 2114abb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/main/java/com/mineblock11/skinshuffle/api/SkinAPIs.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ public static boolean setSkinTexture(String skinURL, String model) {
com.mojang.authlib.minecraft.client.MinecraftClient client = ((YggdrasilUserApiServiceAccessor) apiService).getMinecraftClient();
String token = ((MinecraftClientAuthAccessor) client).getAccessToken();

String safeModel = model.equals("default") ? "classic" : "slim";

JsonObject obj = new JsonObject();
obj.addProperty("variant", safeModel);
obj.addProperty("variant", model);
obj.addProperty("url", skinURL);
var result = Unirest.post("https://api.minecraftservices.com/minecraft/profile/skins")
.body(GSON.toJson(obj))
Expand Down Expand Up @@ -145,7 +143,7 @@ public static SkinQueryResult getPlayerSkinTexture(String uuid) {
}

String skinURL = skin.get("url").getAsString();
String modelType = "default";
String modelType = "classic";

try {
modelType = skin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package com.mineblock11.skinshuffle.api;

import com.mojang.authlib.properties.Property;
import net.minecraft.client.texture.PlayerSkinProvider;
import org.jetbrains.annotations.Nullable;

public record SkinQueryResult(boolean usesDefaultSkin, @Nullable String skinURL, @Nullable String modelType, @Nullable String textureSignature, @Nullable String textureValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public int getHeight() {
this.textFieldWidget.setChangedListener(str -> updateValidity());

skinModelButton = new CyclingButtonWidget.Builder<String>(Text::of)
.values("default", "slim")
.values("classic", "slim")
.build(0, 0, 192, 20, Text.translatable("skinshuffle.edit.source.skin_model"));

if (currentSourceType != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public static SkinPreset generateDefaultPreset() {

if(!NetworkingUtil.isLoggedIn()) {
Identifier skinTexture = client.getSkinProvider().loadSkin(session.getProfile());
Skin skin = new ResourceSkin(skinTexture, skinTexture.getPath().contains("/slim/") ? "slim" : "default");
Skin skin = new ResourceSkin(skinTexture, skinTexture.getPath().contains("/slim/") ? "slim" : "classic");

return new SkinPreset(skin, name);
} else {
var skinQueryResult = SkinAPIs.getPlayerSkinTexture(session.getUuid());

if(skinQueryResult.usesDefaultSkin()) {
Identifier skinTexture = client.getSkinProvider().loadSkin(session.getProfile());
Skin skin = new ResourceSkin(skinTexture, skinTexture.getPath().contains("/slim/") ? "slim" : "default");
Skin skin = new ResourceSkin(skinTexture, skinTexture.getPath().contains("/slim/") ? "slim" : "classic");

return new SkinPreset(skin, name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String getModel() {
tryLoadModelFromCache();
}

return model == null ? "default" : model;
return model == null ? "classic" : model;
}

@Override
Expand Down

0 comments on commit 2114abb

Please sign in to comment.