mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 22:07:59 +01:00
Convert skins without hdskins
This commit is contained in:
parent
f8a0bc308c
commit
1cdc9582e3
3 changed files with 19 additions and 14 deletions
|
@ -9,8 +9,6 @@ import com.minelittlepony.client.hdskins.gui.RenderDummyPony;
|
|||
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
import com.minelittlepony.client.settings.ClientPonyConfig;
|
||||
import com.minelittlepony.client.LegacySkinConverter;
|
||||
import com.minelittlepony.client.pony.PonyManager;
|
||||
import com.minelittlepony.hdskins.HDSkins;
|
||||
import com.minelittlepony.hdskins.net.LegacySkinServer;
|
||||
|
@ -48,8 +46,6 @@ public class MineLPHDSkins {
|
|||
private void postInit(MinecraftClient minecraft) {
|
||||
HDSkins manager = HDSkins.getInstance();
|
||||
|
||||
// Convert legacy pony skins
|
||||
manager.addSkinModifier(new LegacySkinConverter());
|
||||
// Clear ponies when skins are cleared
|
||||
PonyManager ponyManager = (PonyManager) MineLittlePony.getInstance().getManager();
|
||||
manager.addClearListener(ponyManager::onSkinCacheCleared);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import com.minelittlepony.common.util.TextureConverter;
|
||||
import com.minelittlepony.common.event.SkinFilterCallback;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
|
||||
import static com.minelittlepony.common.event.SkinFilterCallback.copy;
|
||||
|
||||
/**
|
||||
* Called to convert the legacy 64x32 skins to the new 64x64 format.
|
||||
|
@ -9,16 +12,18 @@ import com.minelittlepony.common.util.TextureConverter;
|
|||
* do is copy the wing across.
|
||||
*
|
||||
*/
|
||||
public class LegacySkinConverter implements TextureConverter {
|
||||
public class LegacySkinConverter implements SkinFilterCallback {
|
||||
|
||||
@Override
|
||||
public void convertTexture(Drawer drawer) {
|
||||
public void processImage(NativeImage image, boolean legacy) {
|
||||
if (legacy) {
|
||||
// ( from ) ( offset ) (size) flipX flipY
|
||||
drawer.copy(58, 16, 0, 16, 2, 2, true, false); // top
|
||||
drawer.copy(60, 16, 0, 16, 2, 2, true, false); // bottom
|
||||
drawer.copy(60, 18, -4, 16, 2, 14, true, false); // inside
|
||||
drawer.copy(58, 18, 0, 16, 2, 14, true, false); // back
|
||||
drawer.copy(56, 18, 4, 16, 2, 14, true, false); // outside
|
||||
drawer.copy(62, 18, 0, 16, 2, 14, true, false); // front
|
||||
copy(image, 58, 16, 0, 16, 2, 2, true, false); // top
|
||||
copy(image, 60, 16, 0, 16, 2, 2, true, false); // bottom
|
||||
copy(image, 60, 18, -4, 16, 2, 14, true, false); // inside
|
||||
copy(image, 58, 18, 0, 16, 2, 14, true, false); // back
|
||||
copy(image, 56, 18, 4, 16, 2, 14, true, false); // outside
|
||||
copy(image, 62, 18, 0, 16, 2, 14, true, false); // front
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.client.gui.GuiPonySettings;
|
|||
import com.minelittlepony.client.pony.PonyManager;
|
||||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||
import com.minelittlepony.client.settings.ClientPonyConfig;
|
||||
import com.minelittlepony.common.event.SkinFilterCallback;
|
||||
import com.minelittlepony.common.util.GamePaths;
|
||||
import com.minelittlepony.settings.JsonConfig;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
@ -52,6 +53,9 @@ public class MineLPClient extends MineLittlePony {
|
|||
KeyBindingRegistry.INSTANCE.register(keyBinding);
|
||||
|
||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(ponyManager);
|
||||
|
||||
// convert legacy pony skins
|
||||
SkinFilterCallback.EVENT.register(new LegacySkinConverter());
|
||||
}
|
||||
|
||||
protected ClientPonyConfig createConfig() {
|
||||
|
|
Loading…
Reference in a new issue