Skip to content

Commit

Permalink
Merge branch '1.21' into 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Nov 20, 2024
2 parents d682c80 + e003f08 commit 4352474
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
14 changes: 14 additions & 0 deletions src/main/java/com/minelittlepony/hdskins/client/HDSkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import com.minelittlepony.common.util.GamePaths;
import com.minelittlepony.hdskins.HDSkinsServer;
import com.minelittlepony.hdskins.client.gui.GuiSkins;
import com.minelittlepony.hdskins.client.gui.SettingsScreen;
import com.minelittlepony.hdskins.client.profile.SkinLoader;
import com.minelittlepony.hdskins.client.resources.EquipmentList;
import com.minelittlepony.hdskins.client.resources.SkinResourceManager;
import com.minelittlepony.hdskins.server.SkinServerList;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
Expand Down Expand Up @@ -45,6 +47,8 @@ public static Identifier id(String name) {

private final PrioritySorter skinPrioritySorter = new PrioritySorter();

private boolean configDirty;

public HDSkins() {
instance = this;
}
Expand All @@ -63,6 +67,16 @@ public void onInitializeClient() {
ScreenInitCallback.EVENT.register(this::onScreenInit);

FabricLoader.getInstance().getEntrypoints("hdskins", ClientModInitializer.class).forEach(ClientModInitializer::onInitializeClient);

ClientTickEvents.END_CLIENT_TICK.register(this::onTick);
config.onChangedExternally(config -> configDirty = true);
}

private void onTick(MinecraftClient client) {
if (configDirty && client.currentScreen instanceof SettingsScreen screen) {
screen.init(client, screen.width, screen.height);
}
configDirty = false;
}

private void onScreenInit(Screen screen, ScreenInitCallback.ButtonList buttons) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.jetbrains.annotations.Nullable;

import com.google.common.base.MoreObjects;
import com.minelittlepony.hdskins.client.gui.player.DummyPlayerRenderer.MrBoaty;
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins;
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins.Posture.Pose;
Expand Down Expand Up @@ -65,14 +66,7 @@ public AttributeContainer getAttributes() {

public PlayerSkins<?> getTextures() {
// initialization order is annoying
if (overrideTextures != null) {
return overrideTextures;
}

if (textures == null) {
return PlayerSkins.EMPTY;
}
return textures;
return MoreObjects.firstNonNull(overrideTextures, MoreObjects.firstNonNull(textures, PlayerSkins.EMPTY));
}

public void setOverrideTextures(PlayerSkins<?> textures) {
Expand Down Expand Up @@ -163,8 +157,7 @@ public void updateModel() {
lastHandSwingProgress = handSwingProgress;

if (handSwinging) {
++handSwingTicks;
if (handSwingTicks >= 8) {
if (++handSwingTicks >= 8) {
handSwingTicks = 0;
handSwinging = false;
}
Expand Down

0 comments on commit 4352474

Please sign in to comment.