mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 22:07:59 +01:00
Remove some leftover HDSkins code
This commit is contained in:
parent
66ad5651d6
commit
b3c21cd47d
4 changed files with 0 additions and 196 deletions
|
@ -1,73 +0,0 @@
|
|||
package com.minelittlepony.hdskins.fml;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.minelittlepony.hdskins.HDSkins;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Config extends HDSkins {
|
||||
static final Gson gson = new GsonBuilder()
|
||||
.setPrettyPrinting()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
|
||||
private final Path configFile;
|
||||
|
||||
Config(Path file) {
|
||||
configFile = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getAssetsDirectory() {
|
||||
return FMLPaths.CONFIGDIR.get().getParent().toAbsolutePath().toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig() {
|
||||
try (JsonWriter writer = new JsonWriter(Files.newBufferedWriter(configFile))) {
|
||||
writer.setIndent(" ");
|
||||
|
||||
gson.toJson(this, Config.class, writer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T extends Entity> void addRenderer(Class<T> type, Function<RenderManager, Render<T>> renderer) {
|
||||
RenderingRegistry.registerEntityRenderingHandler(type, rm -> renderer.apply(rm));
|
||||
}
|
||||
|
||||
static Config of(Path file) {
|
||||
Config result = null;
|
||||
|
||||
if (Files.exists(file)) {
|
||||
try (BufferedReader s = Files.newBufferedReader(file)) {
|
||||
result = gson.fromJson(s, Config.class);
|
||||
} catch (IOException ignored) {
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
result = new Config(file);
|
||||
}
|
||||
|
||||
result.saveConfig();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package com.minelittlepony.hdskins.fml;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
@Mod("hdskins")
|
||||
public class ForgeModHDSkins {
|
||||
|
||||
private Config hdskins;
|
||||
|
||||
public ForgeModHDSkins() {
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonInit);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientInit);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
private void commonInit(final FMLCommonSetupEvent event) {
|
||||
|
||||
hdskins = Config.of(FMLPaths.CONFIGDIR.get().resolve("hdskins.json"));
|
||||
|
||||
hdskins.init();
|
||||
}
|
||||
|
||||
private void clientInit(FMLClientSetupEvent event) {
|
||||
hdskins.initComplete();
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package com.minelittlepony.hdskins.litemod;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.minelittlepony.common.client.gui.GuiLiteHost;
|
||||
import com.minelittlepony.hdskins.HDSkinManager;
|
||||
import com.minelittlepony.hdskins.HDSkins;
|
||||
import com.minelittlepony.hdskins.gui.HDSkinsConfigPanel;
|
||||
import com.minelittlepony.hdskins.server.SkinServer;
|
||||
import com.minelittlepony.hdskins.server.SkinServerSerializer;
|
||||
import com.mumfrey.liteloader.Configurable;
|
||||
import com.mumfrey.liteloader.InitCompleteListener;
|
||||
import com.mumfrey.liteloader.ViewportListener;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.mumfrey.liteloader.modconfig.AdvancedExposable;
|
||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
|
||||
import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
||||
import com.mumfrey.liteloader.util.ModUtilities;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.function.Function;
|
||||
|
||||
@ExposableOptions(strategy = ConfigStrategy.Unversioned, filename = "hdskins")
|
||||
public class LiteModHDSkins extends HDSkins implements InitCompleteListener, AdvancedExposable {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return HDSkins.MOD_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return HDSkins.VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig() {
|
||||
LiteLoader.getInstance().writeConfig(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(File configPath) {
|
||||
|
||||
// register config
|
||||
LiteLoader.getInstance().registerExposable(this, null);
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upgradeSettings(String version, File configPath, File oldConfigPath) {
|
||||
HDSkinManager.INSTANCE.clearSkinCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGsonSerialiser(GsonBuilder gsonBuilder) {
|
||||
gsonBuilder.registerTypeAdapter(SkinServer.class, new SkinServerSerializer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getConfigFile(File configFile, File configFileLocation, String defaultFileName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
||||
initComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T extends Entity> void addRenderer(Class<T> type, Function<RenderManager, Render<T>> renderer) {
|
||||
ModUtilities.addRenderer(type, renderer.apply(Minecraft.getInstance().getRenderManager()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getAssetsDirectory() {
|
||||
return LiteLoader.getAssetsDirectory();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.hdskins.litemod;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
Loading…
Reference in a new issue