mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Sort the classes into common/client sourcesets (minimal changes)
This commit is contained in:
parent
a2855237f2
commit
0cba35ec89
179 changed files with 102 additions and 114 deletions
|
@ -6,6 +6,9 @@ import com.mumfrey.liteloader.InitCompleteListener;
|
|||
import com.mumfrey.liteloader.Tickable;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||
import com.mumfrey.liteloader.modconfig.ConfigStrategy;
|
||||
import com.mumfrey.liteloader.modconfig.Exposable;
|
||||
import com.mumfrey.liteloader.modconfig.ExposableOptions;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
|
@ -13,8 +16,6 @@ import java.io.File;
|
|||
|
||||
public class LiteModMineLittlePony implements InitCompleteListener, Tickable, Configurable {
|
||||
|
||||
private MineLittlePony mlp;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MineLittlePony.MOD_NAME;
|
||||
|
@ -31,21 +32,34 @@ public class LiteModMineLittlePony implements InitCompleteListener, Tickable, Co
|
|||
|
||||
@Override
|
||||
public void init(File configPath) {
|
||||
mlp = new MineLittlePony();
|
||||
Config config = new Config();
|
||||
|
||||
MineLittlePony.getInstance().init(config);
|
||||
|
||||
LiteLoader.getInput().registerKeyBinding(MineLittlePony.SETTINGS_GUI);
|
||||
LiteLoader.getInstance().registerExposable(config, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
||||
mlp.postInit(minecraft);
|
||||
MineLittlePony.getInstance().postInit(minecraft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
|
||||
mlp.onTick(minecraft, inGame);
|
||||
MineLittlePony.getInstance().onTick(minecraft, inGame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ConfigPanel> getConfigPanelClass() {
|
||||
return GuiPonySettings.class;
|
||||
}
|
||||
|
||||
@ExposableOptions(filename = "minelittlepony", strategy = ConfigStrategy.Unversioned)
|
||||
class Config extends PonyConfig implements Exposable {
|
||||
@Override
|
||||
public void save() {
|
||||
LiteLoader.getInstance().writeConfig(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,11 +2,10 @@ package com.minelittlepony;
|
|||
|
||||
import com.minelittlepony.gui.GuiPonySettings;
|
||||
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
import com.minelittlepony.pony.data.PonyData;
|
||||
import com.minelittlepony.pony.data.PonyDataSerialiser;
|
||||
import com.minelittlepony.pony.data.PonyManager;
|
||||
import com.minelittlepony.render.skull.PonySkullRenderer;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||
import com.voxelmodpack.hdskins.server.LegacySkinServer;
|
||||
import com.voxelmodpack.hdskins.server.SkinServer;
|
||||
|
@ -40,35 +39,27 @@ public class MineLittlePony {
|
|||
private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com";
|
||||
private static final String MINELP_LEGACY_GATEWAY = "http://minelpskinmanager.voxelmodpack.com";
|
||||
|
||||
private static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
|
||||
static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
|
||||
|
||||
private static MineLittlePony instance;
|
||||
|
||||
private final PonyConfig config;
|
||||
private final PonyManager ponyManager;
|
||||
|
||||
private final PonyRenderManager renderManager;
|
||||
private static final MineLittlePony instance = new MineLittlePony();
|
||||
|
||||
private static int modelUpdateCounter = 0;
|
||||
private static boolean reloadingModels = false;
|
||||
|
||||
MineLittlePony() {
|
||||
instance = this;
|
||||
private PonyConfig config;
|
||||
private PonyManager ponyManager;
|
||||
|
||||
LiteLoader.getInput().registerKeyBinding(SETTINGS_GUI);
|
||||
private final PonyRenderManager renderManager = new PonyRenderManager();
|
||||
|
||||
config = new PonyConfig();
|
||||
void init(PonyConfig newConfig) {
|
||||
config = newConfig;
|
||||
ponyManager = new PonyManager(config);
|
||||
|
||||
renderManager = new PonyRenderManager();
|
||||
|
||||
LiteLoader.getInstance().registerExposable(config, null);
|
||||
|
||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
irrm.registerReloadListener(ponyManager);
|
||||
|
||||
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
|
||||
ms.registerMetadataSectionType(new PonyDataSerialiser(), IPonyData.class);
|
||||
ms.registerMetadataSectionType(new PonyDataSerialiser(), PonyData.class);
|
||||
|
||||
// This also makes it the default gateway server.
|
||||
SkinServer.defaultServers.add(new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY));
|
||||
|
@ -124,11 +115,12 @@ public class MineLittlePony {
|
|||
PonySkullRenderer.resolve();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the global MineLP instance.
|
||||
*/
|
||||
public static MineLittlePony getInstance() {
|
||||
return instance;
|
||||
return MineLittlePony.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,5 +147,4 @@ public class MineLittlePony {
|
|||
public static PonyConfig getConfig() {
|
||||
return getInstance().config;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ import com.minelittlepony.PonyConfig;
|
|||
import com.minelittlepony.PonyConfig.PonySettings;
|
||||
import com.minelittlepony.pony.data.PonyLevel;
|
||||
import com.minelittlepony.render.ponies.MobRenderers;
|
||||
import com.mumfrey.liteloader.core.LiteLoader;
|
||||
|
||||
/**
|
||||
* In-Game options menu.
|
||||
|
@ -100,7 +99,7 @@ public class GuiPonySettings extends SettingsPanel {
|
|||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
LiteLoader.getInstance().writeConfig(config);
|
||||
config.save();
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.model.capabilities.IModelWrapper;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class ModelWrapper implements IModelWrapper {
|
|||
|
||||
private final AbstractPonyModel body;
|
||||
|
||||
private final IEquestrianArmor<?> armor;
|
||||
private final IEquestrianArmour<?> armor;
|
||||
|
||||
private int lastModelUpdate = 0;
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class ModelWrapper implements IModelWrapper {
|
|||
/**
|
||||
* Returns the contained armour model.
|
||||
*/
|
||||
public IEquestrianArmor<?> getArmor() {
|
||||
public IEquestrianArmour<?> getArmor() {
|
||||
return armor;
|
||||
}
|
||||
|
|
@ -10,20 +10,19 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.ForgeProxy;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor.ArmorLayer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> implements IArmorTextureResolver<T> {
|
||||
public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> implements IArmourTextureResolver<T> {
|
||||
|
||||
private final Map<String, ResourceLocation> HUMAN_ARMOUR = Maps.newHashMap();
|
||||
private final Map<ResourceLocation, ResourceLocation> PONY_ARMOUR = Maps.newHashMap();
|
||||
|
||||
@Override
|
||||
public ResourceLocation getArmorTexture(T entity, ItemStack itemstack, EntityEquipmentSlot slot, ArmorLayer layer, @Nullable String type) {
|
||||
public ResourceLocation getArmourTexture(T entity, ItemStack itemstack, EntityEquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
ItemArmor item = (ItemArmor) itemstack.getItem();
|
||||
String texture = item.getArmorMaterial().getName();
|
||||
|
||||
|
@ -38,7 +37,7 @@ public class DefaultPonyArmorTextureResolver<T extends EntityLivingBase> impleme
|
|||
String customType = type == null ? "" : String.format("_%s", type);
|
||||
|
||||
String ponyRes = String.format("%s:textures/models/armor/%s_layer_%s%s.png", domain, texture, layer.name().toLowerCase(), customType);
|
||||
String oldPonyRes = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, layer == ArmorLayer.INNER ? 2 : 1, customType);
|
||||
String oldPonyRes = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, layer == ArmourLayer.INNER ? 2 : 1, customType);
|
||||
|
||||
ResourceLocation human = getArmorTexture(entity, itemstack, ponyRes, slot, type);
|
||||
ResourceLocation pony = ponifyResource(human);
|
|
@ -5,10 +5,10 @@ import net.minecraft.entity.Entity;
|
|||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.model.capabilities.IModelArmor;
|
||||
import com.minelittlepony.model.capabilities.IModelArmour;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
||||
public class ModelPonyArmor extends AbstractPonyModel implements IModelArmor {
|
||||
public class ModelPonyArmor extends AbstractPonyModel implements IModelArmour {
|
||||
|
||||
public PonyRenderer chestPiece;
|
||||
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.model.armour;
|
|||
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
|
||||
public class PonyArmor implements IEquestrianArmor<ModelPonyArmor> {
|
||||
public class PonyArmor implements IEquestrianArmour<ModelPonyArmor> {
|
||||
|
||||
private final ModelPonyArmor outerLayer;
|
||||
private final ModelPonyArmor innerLayer;
|
||||
|
@ -25,9 +25,9 @@ public class PonyArmor implements IEquestrianArmor<ModelPonyArmor> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ModelPonyArmor getArmorForLayer(ArmorLayer layer) {
|
||||
public ModelPonyArmor getArmorForLayer(ArmourLayer layer) {
|
||||
|
||||
if (layer == ArmorLayer.INNER) {
|
||||
if (layer == ArmourLayer.INNER) {
|
||||
return innerLayer;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.model.capabilities;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
import com.minelittlepony.pony.data.PonySize;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
|
@ -32,7 +32,7 @@ public interface IModel extends ICapitated {
|
|||
/**
|
||||
* Returns a new pony armour to go with this model. Called on startup by a model wrapper.
|
||||
*/
|
||||
IEquestrianArmor<?> createArmour();
|
||||
IEquestrianArmour<?> createArmour();
|
||||
|
||||
/**
|
||||
* Gets the skin metadata associated with this model.
|
|
@ -3,9 +3,9 @@ package com.minelittlepony.model.capabilities;
|
|||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor.ArmorLayer;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
|
||||
public interface IModelArmor {
|
||||
public interface IModelArmour {
|
||||
/**
|
||||
* Called to synchronise this model's legs with that of another.
|
||||
*
|
||||
|
@ -26,7 +26,7 @@ public interface IModelArmor {
|
|||
*
|
||||
* @return false to skip this render pass.
|
||||
*/
|
||||
default boolean prepareToRender(EntityEquipmentSlot slot, ArmorLayer layer) {
|
||||
default boolean prepareToRender(EntityEquipmentSlot slot, ArmourLayer layer) {
|
||||
setInVisible();
|
||||
|
||||
switch (layer) {
|
|
@ -231,7 +231,7 @@ public class Pony extends Touchable<Pony> implements IPony {
|
|||
|
||||
return new AxisAlignedBB(
|
||||
- width, (entity.height * scale), -width,
|
||||
width, 0, width).offset(pos);
|
||||
width, 0, width).offset(pos);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.pony.data;
|
||||
|
||||
import net.minecraft.client.resources.data.IMetadataSection;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.minelittlepony.model.anim.BasicEasingInterpolator;
|
||||
import com.minelittlepony.model.anim.IInterpolator;
|
||||
|
@ -15,7 +17,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
*
|
||||
*/
|
||||
@Immutable
|
||||
public class PonyData implements IPonyData {
|
||||
public class PonyData implements IPonyData, IMetadataSection {
|
||||
private final PonyRace race;
|
||||
private final TailLengths tailSize;
|
||||
private final PonyGender gender;
|
|
@ -7,7 +7,7 @@ import net.minecraft.client.resources.data.IMetadataSectionSerializer;
|
|||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class PonyDataSerialiser implements IMetadataSectionSerializer<IPonyData> {
|
||||
public class PonyDataSerialiser implements IMetadataSectionSerializer<PonyData> {
|
||||
|
||||
public static final String NAME = "pony";
|
||||
|
|
@ -46,7 +46,7 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
|||
*/
|
||||
private List<ResourceLocation> backgroundPonyList = Lists.newArrayList();
|
||||
|
||||
private PonyConfig config;
|
||||
private final PonyConfig config;
|
||||
|
||||
private final ChronicCache<ResourceLocation, Pony> poniesCache = new ChronicCache<>();
|
||||
|
|
@ -2,11 +2,11 @@ package com.minelittlepony.render.layer;
|
|||
|
||||
import com.minelittlepony.ForgeProxy;
|
||||
import com.minelittlepony.model.ModelWrapper;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor.ArmorLayer;
|
||||
import com.minelittlepony.model.armour.IArmorTextureResolver;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.model.armour.DefaultPonyArmorTextureResolver;
|
||||
import com.minelittlepony.model.capabilities.IModelArmor;
|
||||
import com.minelittlepony.model.capabilities.IModelArmour;
|
||||
import com.minelittlepony.util.render.Color;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
@ -24,7 +24,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLayer<T> {
|
||||
|
||||
private static final IArmorTextureResolver<EntityLivingBase> textures = new DefaultPonyArmorTextureResolver<>();
|
||||
private static final IArmourTextureResolver<EntityLivingBase> textures = new DefaultPonyArmorTextureResolver<>();
|
||||
|
||||
private ModelWrapper pony;
|
||||
|
||||
|
@ -38,13 +38,13 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
|
||||
for (EntityEquipmentSlot i : EntityEquipmentSlot.values()) {
|
||||
if (i.getSlotType() == Type.ARMOR) {
|
||||
renderArmor(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale, i, ArmorLayer.INNER);
|
||||
renderArmor(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale, i, ArmorLayer.OUTER);
|
||||
renderArmor(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale, i, ArmourLayer.INNER);
|
||||
renderArmor(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale, i, ArmourLayer.OUTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private <V extends ModelBiped & IModelArmor> void renderArmor(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot, ArmorLayer layer) {
|
||||
private <V extends ModelBiped & IModelArmour> void renderArmor(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot, ArmourLayer layer) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(armorSlot);
|
||||
|
||||
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) {
|
||||
|
@ -59,9 +59,9 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
armour.synchroniseLegs(pony.getBody());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
IArmorTextureResolver<T> resolver = armour instanceof IArmorTextureResolver ? (IArmorTextureResolver<T>)armour : (IArmorTextureResolver<T>)textures;
|
||||
IArmourTextureResolver<T> resolver = armour instanceof IArmourTextureResolver ? (IArmourTextureResolver<T>)armour : (IArmourTextureResolver<T>)textures;
|
||||
|
||||
ResourceLocation armourTexture = resolver.getArmorTexture(entity, itemstack, armorSlot, layer, null);
|
||||
ResourceLocation armourTexture = resolver.getArmourTexture(entity, itemstack, armorSlot, layer, null);
|
||||
|
||||
getRenderer().bindTexture(armourTexture);
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) {
|
||||
Color.glColor(itemarmor.getColor(itemstack), 1);
|
||||
armour.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
armourTexture = resolver.getArmorTexture(entity, itemstack, armorSlot, layer, "overlay");
|
||||
armourTexture = resolver.getArmourTexture(entity, itemstack, armorSlot, layer, "overlay");
|
||||
getRenderer().bindTexture(armourTexture);
|
||||
}
|
||||
|
||||
|
@ -85,15 +85,15 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <V extends ModelBiped & IModelArmor> V getArmorModel(EntityLivingBase entity, ItemStack itemstack, EntityEquipmentSlot slot, ArmorLayer layer, V def) {
|
||||
private static <V extends ModelBiped & IModelArmour> V getArmorModel(EntityLivingBase entity, ItemStack itemstack, EntityEquipmentSlot slot, ArmourLayer layer, V def) {
|
||||
ModelBase model = ForgeProxy.getArmorModel(entity, itemstack, slot, def);
|
||||
|
||||
if (model instanceof IModelArmor) {
|
||||
if (model instanceof IModelArmour) {
|
||||
return (V)model;
|
||||
}
|
||||
|
||||
if (model instanceof IEquestrianArmor) {
|
||||
return ((IEquestrianArmor<V>) model).getArmorForLayer(layer);
|
||||
if (model instanceof IEquestrianArmour) {
|
||||
return ((IEquestrianArmour<V>) model).getArmorForLayer(layer);
|
||||
}
|
||||
|
||||
return def;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue