Skip to content

Commit

Permalink
fix: 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 committed Nov 19, 2023
1 parent b11f6b7 commit 6993653
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.23
# Mod Properties
mod_version=1.0.1+1.20
mod_version=1.0.2+1.20.2
maven_group=com.mineblock11
archives_base_name=SkinShuffle
# Dependencies
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/mineblock11/skinshuffle/api/SkinAPIs.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ public static void 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", model);
obj.addProperty("variant", safeModel);
obj.addProperty("url", skinURL);
var result = Unirest.post("https://api.minecraftservices.com/minecraft/profile/skins")
.body(GSON.toJson(obj))
.contentType("application/json")
.header("Authorization", "Bearer " + token).asString().getBody();
SkinShuffle.LOGGER.info("Set player skin: " + skinURL);
SkinShuffle.LOGGER.info("Set player skin: " + result);
} catch (Exception e) {
throw new RuntimeException("Cannot connect to Mojang API.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ public static YetAnotherConfigLib getInstance() {
return YetAnotherConfigLib.create(GSON,
(defaults, config, builder) -> {
// Rendering Options
var renderPlayerCapes = Option.<Boolean>createBuilder()
.name(translatable("skinshuffle.config.rendering.render_player_capes.name"))
.description(OptionDescription.createBuilder()
.text(translatable("skinshuffle.config.rendering.render_player_capes.description")).build())
.binding(defaults.renderPlayerCapes, () -> config.renderPlayerCapes, val -> config.renderPlayerCapes = val)
.controller(TickBoxControllerBuilder::create).build();

var carouselRenderStyle = Option.<SkinRenderStyle>createBuilder()
.name(translatable("skinshuffle.config.rendering.carousel_rendering_style.name"))
Expand Down Expand Up @@ -163,7 +157,7 @@ public static YetAnotherConfigLib getInstance() {
).category(ConfigCategory.createBuilder()
.name(translatable("skinshuffle.config.rendering.title"))
.tooltip(translatable("skinshuffle.config.rendering.description"))
.options(List.of(carouselRenderStyle, presetEditScreenRenderStyle, widgetRenderStyle, rotationMultiplier, renderPlayerCapes))
.options(List.of(carouselRenderStyle, presetEditScreenRenderStyle, widgetRenderStyle, rotationMultiplier))
.build()
).category(ConfigCategory.createBuilder()
.name(translatable("skinshuffle.config.popups.title"))
Expand All @@ -183,7 +177,6 @@ public static YetAnotherConfigLib getInstance() {

@ConfigEntry public float carouselScrollSensitivity = 1.0f;
@ConfigEntry public boolean invertCarouselScroll = false;
@ConfigEntry public boolean renderPlayerCapes = true;

@ConfigEntry public SkinRenderStyle widgetSkinRenderStyle = SkinRenderStyle.CURSOR;
@ConfigEntry public SkinRenderStyle carouselSkinRenderStyle = SkinRenderStyle.ROTATION;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
*
* Copyright (C) 2023 Calum (mineblock11), enjarai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/

package com.mineblock11.skinshuffle.client.gui.cursed;

import com.mojang.datafixers.util.Pair;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
*
* Copyright (C) 2023 Calum (mineblock11), enjarai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/

package com.mineblock11.skinshuffle.client.gui.cursed;

import com.mineblock11.skinshuffle.SkinShuffle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
*
* Copyright (C) 2023 Calum (mineblock11), enjarai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/

package com.mineblock11.skinshuffle.client.gui.cursed;

import com.mineblock11.skinshuffle.SkinShuffle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
*
* Copyright (C) 2023 Calum (mineblock11), enjarai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/

package com.mineblock11.skinshuffle.client.gui.cursed;

import com.mineblock11.skinshuffle.client.preset.SkinPreset;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
*
* Copyright (C) 2023 Calum (mineblock11), enjarai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/

package com.mineblock11.skinshuffle.client.gui.cursed;

import com.mineblock11.skinshuffle.SkinShuffle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.client.QuickPlay;
import net.minecraft.client.gui.screen.MessageScreen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.realms.gui.screen.RealmsMainScreen;
import net.minecraft.text.Text;
import net.minecraft.util.WorldSavePath;
Expand All @@ -54,12 +55,8 @@ public static void handleReconnect(MinecraftClient client) {
client.disconnect(new MessageScreen(Text.translatable("skinshuffle.reconnect.rejoining")));
} else {
folderName = null;
if(client.getServer() != null) {
if(client.getServer().isRemote()) {
serverAddress = client.getServer().getServerIp();
} else {
serverAddress = null;
}
if(!client.getNetworkHandler().getConnection().isLocal()) {
serverAddress = client.getNetworkHandler().getServerInfo().address;
} else {
serverAddress = null;
}
Expand All @@ -77,8 +74,6 @@ public static void handleReconnect(MinecraftClient client) {
throw new RuntimeException(e);
}
});
} else if (serverAddress == null) {
client.setScreen(new RealmsMainScreen(new TitleScreen()));
} else {
client.executeTask(() -> {
try {
Expand Down

0 comments on commit 6993653

Please sign in to comment.