2019-06-27 02:33:05 +02:00
|
|
|
package com.minelittlepony.client.hdskins;
|
2019-05-28 12:41:06 +02:00
|
|
|
|
2019-06-30 04:01:28 +02:00
|
|
|
import com.minelittlepony.MineLittlePony;
|
|
|
|
import com.minelittlepony.client.ClientReadyCallback;
|
|
|
|
import com.minelittlepony.client.SkinsProxy;
|
2019-06-27 02:33:05 +02:00
|
|
|
import com.minelittlepony.client.hdskins.gui.DummyPony;
|
|
|
|
import com.minelittlepony.client.hdskins.gui.GuiSkinsMineLP;
|
|
|
|
import com.minelittlepony.client.hdskins.gui.RenderDummyPony;
|
2019-07-03 01:57:45 +02:00
|
|
|
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
|
2019-05-28 12:41:06 +02:00
|
|
|
import net.minecraft.client.MinecraftClient;
|
2019-06-27 02:33:05 +02:00
|
|
|
|
2019-06-30 04:01:28 +02:00
|
|
|
import com.minelittlepony.client.pony.PonyManager;
|
2019-05-28 12:41:06 +02:00
|
|
|
import com.minelittlepony.hdskins.HDSkins;
|
|
|
|
import com.minelittlepony.hdskins.net.LegacySkinServer;
|
|
|
|
import com.minelittlepony.hdskins.net.SkinServer;
|
|
|
|
import com.minelittlepony.hdskins.net.ValhallaSkinServer;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All the interactions with HD Skins.
|
|
|
|
*/
|
2019-07-04 05:40:56 +02:00
|
|
|
class MineLPHDSkins {
|
2019-05-28 12:41:06 +02:00
|
|
|
private static final String MINELP_VALHALLA_SERVER = "http://skins.minelittlepony-mod.com";
|
|
|
|
|
|
|
|
private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com";
|
|
|
|
private static final String MINELP_LEGACY_GATEWAY = "http://minelpskinmanager.voxelmodpack.com";
|
|
|
|
|
2019-07-03 01:57:45 +02:00
|
|
|
public MineLPHDSkins() {
|
2019-06-30 04:01:28 +02:00
|
|
|
SkinsProxy.instance = new HDSkinsProxy();
|
|
|
|
|
2019-06-11 01:06:17 +02:00
|
|
|
SkinServer legacy = new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY);
|
|
|
|
SkinServer valhalla = new ValhallaSkinServer(MINELP_VALHALLA_SERVER);
|
2019-05-28 12:41:06 +02:00
|
|
|
// Register pony servers
|
2019-06-11 01:06:17 +02:00
|
|
|
HDSkins.getInstance().addSkinServer(legacy);
|
|
|
|
HDSkins.getInstance().addSkinServer(valhalla);
|
|
|
|
|
|
|
|
SkinServer.defaultServers.add(legacy);
|
2019-05-28 12:41:06 +02:00
|
|
|
// And make valhalla the default
|
2019-06-11 01:06:17 +02:00
|
|
|
SkinServer.defaultServers.add(0, valhalla);
|
2019-05-28 12:41:06 +02:00
|
|
|
|
2019-06-30 04:01:28 +02:00
|
|
|
ClientReadyCallback.EVENT.register(this::postInit);
|
2019-05-28 12:41:06 +02:00
|
|
|
|
2019-06-30 06:46:31 +02:00
|
|
|
// Preview on the select skin gui
|
2019-07-03 01:57:45 +02:00
|
|
|
EntityRendererRegistry.INSTANCE.register(DummyPony.class, RenderDummyPony::new);
|
2019-06-30 04:01:28 +02:00
|
|
|
}
|
2019-06-30 12:05:38 +02:00
|
|
|
|
2019-06-30 04:01:28 +02:00
|
|
|
private void postInit(MinecraftClient minecraft) {
|
2019-05-28 12:41:06 +02:00
|
|
|
HDSkins manager = HDSkins.getInstance();
|
|
|
|
|
|
|
|
// Clear ponies when skins are cleared
|
2019-06-30 04:01:28 +02:00
|
|
|
PonyManager ponyManager = (PonyManager) MineLittlePony.getInstance().getManager();
|
|
|
|
manager.addClearListener(ponyManager::onSkinCacheCleared);
|
|
|
|
|
2019-05-28 12:41:06 +02:00
|
|
|
// Ponify the skins GUI.
|
|
|
|
manager.setSkinsGui(GuiSkinsMineLP::new);
|
|
|
|
}
|
|
|
|
}
|