Commit f056dd02 by Jonathan Thomas

More code cleanup and removing log statements

parent 9405b2c2
Pipeline #13260 passed with stages
in 2 minutes 5 seconds
......@@ -11,7 +11,7 @@ archives_base_name=creaturechat
# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.10
loader_version=0.15.11
#Fabric api
fabric_version=0.97.0+1.20.4
\ No newline at end of file
......@@ -3,8 +3,6 @@ package com.owlmaddie.mixin.client;
import com.owlmaddie.skin.PlayerCustomTexture;
import com.owlmaddie.skin.SkinUtils;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
......@@ -13,8 +11,6 @@ import org.spongepowered.asm.mixin.Overwrite;
*/
@Mixin(PlayerCustomTexture.class)
public abstract class MixinPlayerCustomTexture {
private static final Logger LOGGER = LoggerFactory.getLogger("creaturechat");
/**
* Overwrites the default implementation of hasCustomIcon to provide custom skin support.
*
......@@ -27,7 +23,6 @@ public abstract class MixinPlayerCustomTexture {
@Overwrite
public static boolean hasCustomIcon(Identifier skinId) {
// Delegate to SkinUtils to check for custom skin properties
LOGGER.info("mixin hasCustomIcon called");
return SkinUtils.checkCustomSkinKey(skinId);
}
}
......@@ -4,20 +4,19 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.AbstractTexture;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* SkinUtils contains functions to check for certain black and white pixel values in a skin, to determine
* if the skin contains a custom hidden icon to show in the player chat message.
*/
public class SkinUtils {
private static final Logger LOGGER = LoggerFactory.getLogger("creaturechat");
public static boolean checkCustomSkinKey(Identifier skinId) {
LOGGER.info("mixin checkCustomSkinKey called");
// 1. Grab the AbstractTexture from the TextureManager
// Grab the AbstractTexture from the TextureManager
AbstractTexture tex = MinecraftClient.getInstance().getTextureManager().getTexture(skinId);
// 2. Check if it implements our Mixin interface: IPlayerSkinTexture
// Check if it implements our Mixin interface: IPlayerSkinTexture
if (tex instanceof IPlayerSkinTexture iSkin) {
// 3. Get the NativeImage we stored in the Mixin
// Get the NativeImage we stored in the Mixin
NativeImage image = iSkin.getLoadedImage();
if (image != null) {
int width = image.getWidth();
......
......@@ -33,7 +33,7 @@
"accessWidener": "creaturechat.accesswidener",
"depends": {
"fabricloader": ">=0.14.22",
"minecraft": "~1.20",
"minecraft": "~1.20.4",
"java": ">=17",
"fabric-api": "*"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment