From 0798fa88d34e5a46f4b6639a5d8f71dad0e70c39 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 13 Jul 2018 20:01:35 +0200 Subject: [PATCH] Combine PonyArmour and IEquestrianArmor --- .../com/minelittlepony/api/armor/IEquestrianArmor.java | 7 ------- .../java/com/minelittlepony/api/armor/package-info.java | 7 ------- .../com/minelittlepony/model/armour/IEquestrianArmor.java | 7 +++++++ .../java/com/minelittlepony/model/armour/PonyArmor.java | 5 ++++- .../com/minelittlepony/render/layer/LayerPonyArmor.java | 4 ++-- 5 files changed, 13 insertions(+), 17 deletions(-) delete mode 100644 src/main/java/com/minelittlepony/api/armor/IEquestrianArmor.java delete mode 100644 src/main/java/com/minelittlepony/api/armor/package-info.java create mode 100644 src/main/java/com/minelittlepony/model/armour/IEquestrianArmor.java diff --git a/src/main/java/com/minelittlepony/api/armor/IEquestrianArmor.java b/src/main/java/com/minelittlepony/api/armor/IEquestrianArmor.java deleted file mode 100644 index 41fa810a..00000000 --- a/src/main/java/com/minelittlepony/api/armor/IEquestrianArmor.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.minelittlepony.api.armor; - -import com.minelittlepony.model.armour.PonyArmor; - -public interface IEquestrianArmor { - PonyArmor getEquestrianArmour(); -} diff --git a/src/main/java/com/minelittlepony/api/armor/package-info.java b/src/main/java/com/minelittlepony/api/armor/package-info.java deleted file mode 100644 index abae6cfc..00000000 --- a/src/main/java/com/minelittlepony/api/armor/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault -package com.minelittlepony.api.armor; - -import mcp.MethodsReturnNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/minelittlepony/model/armour/IEquestrianArmor.java b/src/main/java/com/minelittlepony/model/armour/IEquestrianArmor.java new file mode 100644 index 00000000..a0a58139 --- /dev/null +++ b/src/main/java/com/minelittlepony/model/armour/IEquestrianArmor.java @@ -0,0 +1,7 @@ +package com.minelittlepony.model.armour; + +import net.minecraft.inventory.EntityEquipmentSlot; + +public interface IEquestrianArmor { + ModelPonyArmor getArmorForSlot(EntityEquipmentSlot slot); +} diff --git a/src/main/java/com/minelittlepony/model/armour/PonyArmor.java b/src/main/java/com/minelittlepony/model/armour/PonyArmor.java index fd5f6897..56e0d48c 100644 --- a/src/main/java/com/minelittlepony/model/armour/PonyArmor.java +++ b/src/main/java/com/minelittlepony/model/armour/PonyArmor.java @@ -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; diff --git a/src/main/java/com/minelittlepony/render/layer/LayerPonyArmor.java b/src/main/java/com/minelittlepony/render/layer/LayerPonyArmor.java index 2fe9130c..ba25e5fc 100644 --- a/src/main/java/com/minelittlepony/render/layer/LayerPonyArmor.java +++ b/src/main/java/com/minelittlepony/render/layer/LayerPonyArmor.java @@ -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 extends AbstractPonyLaye } if (model instanceof IEquestrianArmor) { - return ((IEquestrianArmor) model).getEquestrianArmour().getArmorForSlot(slot); + return ((IEquestrianArmor) model).getArmorForSlot(slot); } return def;