mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Combine PonyArmour and IEquestrianArmor
This commit is contained in:
parent
6839105881
commit
0798fa88d3
5 changed files with 13 additions and 17 deletions
|
@ -1,7 +0,0 @@
|
||||||
package com.minelittlepony.api.armor;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.armour.PonyArmor;
|
|
||||||
|
|
||||||
public interface IEquestrianArmor {
|
|
||||||
PonyArmor getEquestrianArmour();
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
@ParametersAreNonnullByDefault
|
|
||||||
package com.minelittlepony.api.armor;
|
|
||||||
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.minelittlepony.model.armour;
|
||||||
|
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
|
||||||
|
public interface IEquestrianArmor {
|
||||||
|
ModelPonyArmor getArmorForSlot(EntityEquipmentSlot slot);
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import com.minelittlepony.pony.data.IPonyData;
|
||||||
|
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
|
||||||
public class PonyArmor implements IModelWrapper {
|
public class PonyArmor implements IModelWrapper, IEquestrianArmor {
|
||||||
|
|
||||||
public final ModelPonyArmor chestplate;
|
public final ModelPonyArmor chestplate;
|
||||||
public final ModelPonyArmor leggings;
|
public final ModelPonyArmor leggings;
|
||||||
|
@ -15,16 +15,19 @@ public class PonyArmor implements IModelWrapper {
|
||||||
leggings = body;
|
leggings = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void apply(IPonyData meta) {
|
public void apply(IPonyData meta) {
|
||||||
chestplate.metadata = meta;
|
chestplate.metadata = meta;
|
||||||
leggings.metadata = meta;
|
leggings.metadata = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
chestplate.init(0, 1);
|
chestplate.init(0, 1);
|
||||||
leggings.init(0, 0.5f);
|
leggings.init(0, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ModelPonyArmor getArmorForSlot(EntityEquipmentSlot slot) {
|
public ModelPonyArmor getArmorForSlot(EntityEquipmentSlot slot) {
|
||||||
if (slot == EntityEquipmentSlot.LEGS) {
|
if (slot == EntityEquipmentSlot.LEGS) {
|
||||||
return leggings;
|
return leggings;
|
||||||
|
|
|
@ -2,9 +2,9 @@ package com.minelittlepony.render.layer;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.minelittlepony.ForgeProxy;
|
import com.minelittlepony.ForgeProxy;
|
||||||
import com.minelittlepony.api.armor.IEquestrianArmor;
|
|
||||||
import com.minelittlepony.api.events.EventBus;
|
import com.minelittlepony.api.events.EventBus;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
import com.minelittlepony.model.ModelWrapper;
|
||||||
|
import com.minelittlepony.model.armour.IEquestrianArmor;
|
||||||
import com.minelittlepony.model.armour.ModelPonyArmor;
|
import com.minelittlepony.model.armour.ModelPonyArmor;
|
||||||
import com.minelittlepony.model.capabilities.IModelArmor;
|
import com.minelittlepony.model.capabilities.IModelArmor;
|
||||||
import com.minelittlepony.util.coordinates.Color;
|
import com.minelittlepony.util.coordinates.Color;
|
||||||
|
@ -177,7 +177,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model instanceof IEquestrianArmor) {
|
if (model instanceof IEquestrianArmor) {
|
||||||
return ((IEquestrianArmor) model).getEquestrianArmour().getArmorForSlot(slot);
|
return ((IEquestrianArmor) model).getArmorForSlot(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
|
Loading…
Reference in a new issue