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 ...@@ -11,7 +11,7 @@ archives_base_name=creaturechat
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.20.4 minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3 yarn_mappings=1.20.4+build.3
loader_version=0.15.10 loader_version=0.15.11
#Fabric api #Fabric api
fabric_version=0.97.0+1.20.4 fabric_version=0.97.0+1.20.4
\ No newline at end of file
...@@ -3,8 +3,6 @@ package com.owlmaddie.mixin.client; ...@@ -3,8 +3,6 @@ package com.owlmaddie.mixin.client;
import com.owlmaddie.skin.PlayerCustomTexture; import com.owlmaddie.skin.PlayerCustomTexture;
import com.owlmaddie.skin.SkinUtils; import com.owlmaddie.skin.SkinUtils;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Overwrite;
...@@ -13,8 +11,6 @@ import org.spongepowered.asm.mixin.Overwrite; ...@@ -13,8 +11,6 @@ import org.spongepowered.asm.mixin.Overwrite;
*/ */
@Mixin(PlayerCustomTexture.class) @Mixin(PlayerCustomTexture.class)
public abstract class MixinPlayerCustomTexture { public abstract class MixinPlayerCustomTexture {
private static final Logger LOGGER = LoggerFactory.getLogger("creaturechat");
/** /**
* Overwrites the default implementation of hasCustomIcon to provide custom skin support. * Overwrites the default implementation of hasCustomIcon to provide custom skin support.
* *
...@@ -27,7 +23,6 @@ public abstract class MixinPlayerCustomTexture { ...@@ -27,7 +23,6 @@ public abstract class MixinPlayerCustomTexture {
@Overwrite @Overwrite
public static boolean hasCustomIcon(Identifier skinId) { public static boolean hasCustomIcon(Identifier skinId) {
// Delegate to SkinUtils to check for custom skin properties // Delegate to SkinUtils to check for custom skin properties
LOGGER.info("mixin hasCustomIcon called");
return SkinUtils.checkCustomSkinKey(skinId); return SkinUtils.checkCustomSkinKey(skinId);
} }
} }
...@@ -4,20 +4,19 @@ import net.minecraft.client.MinecraftClient; ...@@ -4,20 +4,19 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.AbstractTexture; import net.minecraft.client.texture.AbstractTexture;
import net.minecraft.client.texture.NativeImage; import net.minecraft.client.texture.NativeImage;
import net.minecraft.util.Identifier; 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 { public class SkinUtils {
private static final Logger LOGGER = LoggerFactory.getLogger("creaturechat");
public static boolean checkCustomSkinKey(Identifier skinId) { public static boolean checkCustomSkinKey(Identifier skinId) {
LOGGER.info("mixin checkCustomSkinKey called"); // Grab the AbstractTexture from the TextureManager
// 1. Grab the AbstractTexture from the TextureManager
AbstractTexture tex = MinecraftClient.getInstance().getTextureManager().getTexture(skinId); 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) { 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(); NativeImage image = iSkin.getLoadedImage();
if (image != null) { if (image != null) {
int width = image.getWidth(); int width = image.getWidth();
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"accessWidener": "creaturechat.accesswidener", "accessWidener": "creaturechat.accesswidener",
"depends": { "depends": {
"fabricloader": ">=0.14.22", "fabricloader": ">=0.14.22",
"minecraft": "~1.20", "minecraft": "~1.20.4",
"java": ">=17", "java": ">=17",
"fabric-api": "*" "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