mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 05:48:00 +01:00
Move most hdskins related classes to new sourceset
This commit is contained in:
parent
50686dd1b4
commit
0bcd2c1968
11 changed files with 36 additions and 27 deletions
14
build.gradle
14
build.gradle
|
@ -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}"
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -9,5 +9,5 @@ pluginManagement {
|
|||
}
|
||||
}
|
||||
rootProject.name = 'MineLittlePony'
|
||||
//includeBuild '../Kirin'
|
||||
//includeBuild '../HDSkins'
|
||||
includeBuild '../Kirin'
|
||||
includeBuild '../HDSkins'
|
|
@ -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;
|
|
@ -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);
|
||||
}
|
|
@ -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,
|
|
@ -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;
|
||||
|
|
@ -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();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.client.gui.hdskins;
|
||||
package com.minelittlepony.client.hdskins.gui;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
|
@ -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);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.gui.hdskins;
|
||||
package com.minelittlepony.client.hdskins.gui;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue