Move most hdskins related classes to new sourceset

This commit is contained in:
Matthew Messinger 2019-06-26 20:33:05 -04:00
parent 50686dd1b4
commit 0bcd2c1968
11 changed files with 36 additions and 27 deletions

View file

@ -39,22 +39,28 @@ if (System.env.CI) {
}
}
sourceSets {
hdskins
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
hdskinsCompileOnly "com.google.code.findbugs:jsr305:3.0.2"
modApi "net.fabricmc.fabric-api:fabric-api-base:0.1.0+"
modApi "net.fabricmc.fabric-api:fabric-events-lifecycle-v0:0.1.0+"
modApi "net.fabricmc.fabric-api:fabric-resource-loader-v0:0.1.0+"
modApi "com.minelittlepony:Kirin:${project.kirin_version}"
compile "com.minelittlepony:Kirin:${project.kirin_version}"
include "com.minelittlepony:Kirin:${project.kirin_version}"
// TODO: HD Skins can be made optional later
// modCompile "com.minelittlepony:HDSkins:${project.hd_skins_version}"
// include "com.minelittlepony:HDSkins:${project.hd_skins_version}"
hdskinsCompile sourceSets.main.output
hdskinsCompile "com.minelittlepony:HDSkins:${project.hd_skins_version}"
}
//

View file

@ -9,5 +9,5 @@ pluginManagement {
}
}
rootProject.name = 'MineLittlePony'
//includeBuild '../Kirin'
//includeBuild '../HDSkins'
includeBuild '../Kirin'
includeBuild '../HDSkins'

View file

@ -1,4 +1,4 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins;
import com.minelittlepony.client.settings.ClientPonyConfig;
import com.minelittlepony.hdskins.HDSkins;

View file

@ -1,14 +1,17 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins;
import com.minelittlepony.client.hdskins.gui.DummyPony;
import com.minelittlepony.client.hdskins.gui.GuiSkinsMineLP;
import com.minelittlepony.client.hdskins.gui.RenderDummyPony;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLPClient;
import com.minelittlepony.client.settings.ClientPonyConfig;
import com.minelittlepony.client.LegacySkinConverter;
import com.minelittlepony.hdskins.HDSkins;
import com.minelittlepony.hdskins.ISkinCacheClearListener;
import com.minelittlepony.hdskins.net.LegacySkinServer;
import com.minelittlepony.hdskins.net.SkinServer;
import com.minelittlepony.hdskins.net.ValhallaSkinServer;
@ -22,7 +25,7 @@ import java.util.Map;
/**
* All the interactions with HD Skins.
*/
class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener {
public class MineLPHDSkins extends MineLPClient {
private static final String MINELP_VALHALLA_SERVER = "http://skins.minelittlepony-mod.com";
private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com";
@ -40,12 +43,6 @@ class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener {
SkinServer.defaultServers.add(0, valhalla);
}
@Override
public boolean onSkinCacheCleared() {
getManager().clearCache();
return true;
}
/**
* Called when the game is ready.
*/
@ -63,7 +60,7 @@ class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener {
// Parse trigger pixel data
manager.addSkinParser(new PonySkinParser());
// Clear ponies when skins are cleared
manager.addClearListener(this);
manager.addClearListener(getManager()::onSkinCacheCleared);
// Ponify the skins GUI.
manager.setSkinsGui(GuiSkinsMineLP::new);
}

View file

@ -1,4 +1,4 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.model.races.PlayerModels;
@ -11,7 +11,7 @@ import net.minecraft.util.Identifier;
import java.util.Map;
class PonySkinParser implements ISkinParser {
public class PonySkinParser implements ISkinParser {
@Override
public void parse(GameProfile profile, MinecraftProfileTexture.Type type, Identifier resource,

View file

@ -1,4 +1,4 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins.gui;
import com.minelittlepony.hdskins.dummy.DummyPlayer;
import com.minelittlepony.hdskins.dummy.TextureProxy;
@ -8,7 +8,7 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
/**
* Dummy model used for the skin uploading screen.
*/
class DummyPony extends DummyPlayer {
public class DummyPony extends DummyPlayer {
public boolean wet = false;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins.gui;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.common.client.gui.element.IconicToggle;
@ -20,7 +20,7 @@ import java.util.List;
/**
* Skin uploading GUI. Usually displayed over the main menu.
*/
class GuiSkinsMineLP extends GuiSkins {
public class GuiSkinsMineLP extends GuiSkins {
private IPonyManager ponyManager = MineLittlePony.getInstance().getManager();

View file

@ -1,4 +1,4 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins.gui;
import net.minecraft.util.Identifier;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins.gui;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.model.ClientPonyModel;
@ -22,7 +22,7 @@ import net.minecraft.util.Identifier;
/**
* Renderer used for the dummy pony model when selecting a skin.
*/
class RenderDummyPony extends RenderDummyPlayer<DummyPony, ClientPonyModel<DummyPony>> implements IPonyRender<DummyPony, ClientPonyModel<DummyPony>> {
public class RenderDummyPony extends RenderDummyPlayer<DummyPony, ClientPonyModel<DummyPony>> implements IPonyRender<DummyPony, ClientPonyModel<DummyPony>> {
protected final RenderPony<DummyPony, ClientPonyModel<DummyPony>> renderPony = new RenderPony<>(this);

View file

@ -1,4 +1,4 @@
@ParametersAreNonnullByDefault
package com.minelittlepony.client.gui.hdskins;
package com.minelittlepony.client.hdskins.gui;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -264,4 +264,10 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList
return MoreStreams.map(imports, this::makeImport);
}
}
public boolean onSkinCacheCleared() {
MineLittlePony.logger.info("Flushed {} cached ponies.", poniesCache.size());
poniesCache.invalidateAll();
return true;
}
}