Combine PonyArmour and IEquestrianArmor

This commit is contained in:
Sollace 2018-07-13 20:01:35 +02:00
parent 6839105881
commit 0798fa88d3
5 changed files with 13 additions and 17 deletions

View file

@ -1,7 +0,0 @@
package com.minelittlepony.api.armor;
import com.minelittlepony.model.armour.PonyArmor;
public interface IEquestrianArmor {
PonyArmor getEquestrianArmour();
}

View file

@ -1,7 +0,0 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.api.armor;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View file

@ -0,0 +1,7 @@
package com.minelittlepony.model.armour;
import net.minecraft.inventory.EntityEquipmentSlot;
public interface IEquestrianArmor {
ModelPonyArmor getArmorForSlot(EntityEquipmentSlot slot);
}

View file

@ -5,7 +5,7 @@ import com.minelittlepony.pony.data.IPonyData;
import net.minecraft.inventory.EntityEquipmentSlot;
public class PonyArmor implements IModelWrapper {
public class PonyArmor implements IModelWrapper, IEquestrianArmor {
public final ModelPonyArmor chestplate;
public final ModelPonyArmor leggings;
@ -15,16 +15,19 @@ public class PonyArmor implements IModelWrapper {
leggings = body;
}
@Override
public void apply(IPonyData meta) {
chestplate.metadata = meta;
leggings.metadata = meta;
}
@Override
public void init() {
chestplate.init(0, 1);
leggings.init(0, 0.5f);
}
@Override
public ModelPonyArmor getArmorForSlot(EntityEquipmentSlot slot) {
if (slot == EntityEquipmentSlot.LEGS) {
return leggings;

View file

@ -2,9 +2,9 @@ package com.minelittlepony.render.layer;
import com.google.common.collect.Maps;
import com.minelittlepony.ForgeProxy;
import com.minelittlepony.api.armor.IEquestrianArmor;
import com.minelittlepony.api.events.EventBus;
import com.minelittlepony.model.ModelWrapper;
import com.minelittlepony.model.armour.IEquestrianArmor;
import com.minelittlepony.model.armour.ModelPonyArmor;
import com.minelittlepony.model.capabilities.IModelArmor;
import com.minelittlepony.util.coordinates.Color;
@ -177,7 +177,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
}
if (model instanceof IEquestrianArmor) {
return ((IEquestrianArmor) model).getEquestrianArmour().getArmorForSlot(slot);
return ((IEquestrianArmor) model).getArmorForSlot(slot);
}
return def;