Search in sources :

Example 1 with EntityEquipmentData

use of riskyken.armourersWorkshop.common.skin.EntityEquipmentData in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method getPlayerCustomArmour.

public Skin getPlayerCustomArmour(Entity entity, ISkinType skinType, int slotIndex) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    // Look for skinned armourer.
    if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
        int slot = 3 - skinType.getVanillaArmourSlotId();
        ItemStack armourStack = player.getCurrentArmor(slot);
        if (SkinNBTHelper.stackHasSkinData(armourStack)) {
            SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
            return getCustomArmourItemData(sp);
        }
    }
    // No skinned armour found checking the equipment wardrobe.
    if (equipmentData == null) {
        return null;
    }
    if (!equipmentData.haveEquipment(skinType, slotIndex)) {
        return null;
    }
    ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, slotIndex);
    return getCustomArmourItemData(skinPointer);
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) ItemStack(net.minecraft.item.ItemStack) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 2 with EntityEquipmentData

use of riskyken.armourersWorkshop.common.skin.EntityEquipmentData in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method getPlayerCustomEquipmentData.

public IEntityEquipment getPlayerCustomEquipmentData(Entity entity) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    return equipmentData;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer)

Example 3 with EntityEquipmentData

use of riskyken.armourersWorkshop.common.skin.EntityEquipmentData in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method getPlayerDyeData.

public ISkinDye getPlayerDyeData(Entity entity, ISkinType skinType, int slotIndex) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    // Look for skinned armourer.
    if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
        int slot = 3 - skinType.getVanillaArmourSlotId();
        ItemStack armourStack = player.getCurrentArmor(slot);
        if (SkinNBTHelper.stackHasSkinData(armourStack)) {
            SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
            return sp.getSkinDye();
        }
    }
    // No skinned armour found checking the equipment wardrobe.
    if (equipmentData == null) {
        return null;
    }
    if (!equipmentData.haveEquipment(skinType, slotIndex)) {
        return null;
    }
    ISkinDye skinDye = equipmentData.getSkinPointer(skinType, slotIndex).getSkinDye();
    return skinDye;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) ISkinDye(riskyken.armourersWorkshop.api.common.skin.data.ISkinDye) ItemStack(net.minecraft.item.ItemStack)

Example 4 with EntityEquipmentData

use of riskyken.armourersWorkshop.common.skin.EntityEquipmentData in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method getPlayerExtraColours.

public byte[] getPlayerExtraColours(Entity entity) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    return null;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer)

Aggregations

AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)4 PlayerPointer (riskyken.armourersWorkshop.common.data.PlayerPointer)4 EntityEquipmentData (riskyken.armourersWorkshop.common.skin.EntityEquipmentData)4 ItemStack (net.minecraft.item.ItemStack)2 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)2 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)2 ISkinDye (riskyken.armourersWorkshop.api.common.skin.data.ISkinDye)1