Конская броня

Версия Minecraft
1.7.10
372
0
Всем добра,

Пытаюсь создать броню для коня, почти все сделано, осталось дописать или переделать ванильный рендер, но что-то мне это удается.
Не могу понять по какому принципу присваивается текстура брони к самой текстурки модели коня.

Если вкратце, создал новые итемы, хакнул ванильный класс коня с помощью либы от Глуми (код ниже)
Java:
@Hook(injectOnExit = true, returnCondition = ReturnCondition.ALWAYS)
public static boolean isItemValid(ContainerHorseInventorySlotArmor slot, ItemStack itemStack) {
    return (itemStack.getItem() instanceof HorseArmorItem) || itemStack.getItem() == Items.iron_horse_armor || itemStack.getItem() == Items.golden_horse_armor || itemStack.getItem() == Items.diamond_horse_armor;
}

@Hook(injectOnExit = true, returnCondition = ReturnCondition.ALWAYS)
public static boolean func_146085_a(EntityHorse entity, Item item) {
    return (item instanceof HorseArmorItem) || item == Items.iron_horse_armor || item == Items.golden_horse_armor || item == Items.diamond_horse_armor;
}

@Hook(injectOnExit = true, returnCondition = ReturnCondition.ALWAYS)
public static int getHorseArmorIndex(EntityHorse entity, ItemStack itemStack) {
    if (itemStack == null) return 0;
    else {
        Item item = itemStack.getItem();
        if (item == Items.iron_horse_armor) return 1;
        else if (item == Items.golden_horse_armor) return 2;
        else if (item == Items.diamond_horse_armor) return 3;
        else if (item == TFCHAItems.horseCopperArmor) return 4;
        else if (item == TFCHAItems.horseBismuthBronzeArmor) return 5;
        else if (item == TFCHAItems.horseBlackBronzeArmor) return 6;
        else if (item == TFCHAItems.horseBronzeArmor) return 7;
        else if (item == TFCHAItems.horseWroughtIronArmor) return 8;
        else if (item == TFCHAItems.horseSteelArmor) return 9;
        else if (item == TFCHAItems.horseBlackSteelArmor) return 10;
        else if (item == TFCHAItems.horseBlueSteelArmor) return 11;
        else if (item == TFCHAItems.horseRedSteelArmor) return 12;
    } return 0;
}
Как я понял (если правильно понял), в методе setHorseTexturePaths (класс EntityHorse) присваивается дорожка к текстуркам.
В конце метода проверяется индекс броньки (хук выше getHorseArmorIndex) и потом вытаскивается из списка нужная текстурка.
Java:
@SideOnly(Side.CLIENT)
public void setHorseTexturePaths()
{
    this.field_110286_bQ = "horse/";
    this.field_110280_bR[0] = null;
    this.field_110280_bR[1] = null;
    this.field_110280_bR[2] = null;
    int i = this.getHorseType();
    int j = this.getHorseVariant();
    int k;

    if (i == 0)
    {
        k = j & 255;
        int l = (j & 65280) >> 8;
        this.field_110280_bR[0] = horseTextures[k];
        this.field_110286_bQ = this.field_110286_bQ + field_110269_bA[k];
        this.field_110280_bR[1] = horseMarkingTextures[l];
        this.field_110286_bQ = this.field_110286_bQ + field_110292_bC[l];
    }
    else
    {
        this.field_110280_bR[0] = "";
        this.field_110286_bQ = this.field_110286_bQ + "[I]" + i + "[/I]";
    }

    k = this.func_110241_cb();
    this.field_110280_bR[2] = horseArmorTextures[k];
    this.field_110286_bQ = this.field_110286_bQ + field_110273_bx[k];
}
Java:
@Hook(injectOnExit = true, returnCondition = ReturnCondition.ALWAYS)
@SideOnly(Side.CLIENT)
public static void setHorseTexturePaths(EntityHorse horseEntity) {
    horseEntity.field_110286_bQ = "horse/";
    horseEntity.field_110280_bR[0] = null;
    horseEntity.field_110280_bR[1] = null;
    horseEntity.field_110280_bR[2] = null;
    int i = horseEntity.getHorseType();
    int j = horseEntity.getHorseVariant();
    int k = 0;

    if (i == 0) {
        k = j & 255;
        int l = (j & 65280) >> 8;
        horseEntity.field_110280_bR[0] = horseEntity.horseTextures[k];
        horseEntity.field_110286_bQ = horseEntity.field_110286_bQ + horseEntity.field_110269_bA[k];
        horseEntity.field_110280_bR[1] = horseEntity.horseMarkingTextures[l];
        horseEntity.field_110286_bQ = horseEntity.field_110286_bQ + horseEntity.field_110292_bC[l];
    } else {
        horseEntity.field_110280_bR[0] = "";
        horseEntity.field_110286_bQ = horseEntity.field_110286_bQ + "[I]" + i + "[/I]";
    }

    String armor = "";
    if (horseEntity.horseChest.getStackInSlot(1) != null) {
        Item item = horseEntity.horseChest.getStackInSlot(1).getItem();
        if (item == Items.iron_horse_armor) armor = "textures/entity/horse/armor/horse_armor_iron.png";
        else if (item == Items.golden_horse_armor) armor = "textures/entity/horse/armor/horse_armor_gold.png";
        else if (item == Items.diamond_horse_armor) armor = "textures/entity/horse/armor/horse_armor_diamond.png";
        else if (item == TFCHAItems.horseCopperArmor) armor = "textures/models/armor/horseCopperArmor.png";
        else if (item == TFCHAItems.horseBismuthBronzeArmor) armor = "textures/models/armor/horseBismuthBronzeArmor.png";
        else if (item == TFCHAItems.horseBlackBronzeArmor) armor = "textures/models/armor/horseBlackBronzeArmor.png";
        else if (item == TFCHAItems.horseBronzeArmor) armor = "textures/models/armor/horseBronzeArmor.png";
        else if (item == TFCHAItems.horseWroughtIronArmor) armor = "textures/models/armor/horseWroughtIronArmor.png";
        else if (item == TFCHAItems.horseSteelArmor) armor = "textures/models/armor/horseSteelArmor.png";
        else if (item == TFCHAItems.horseBlackSteelArmor) armor = "textures/models/armor/horseBlackSteelArmor.png";
        else if (item == TFCHAItems.horseBlueSteelArmor) armor = "textures/models/armor/horseBlueSteelArmor.png";
        else if (item == TFCHAItems.horseRedSteelArmor) armor = "textures/models/armor/horseRedSteelArmor.png";
    }

    horseEntity.field_110280_bR[2] = armor;
    horseEntity.field_110286_bQ = horseEntity.field_110286_bQ + horseEntity.field_110273_bx[k];
}
В консоли ловлю ошибку java.lang.ArrayIndexOutOfBoundsException, но ведь я обращаюсь нормально со списком? Или он где-то тоже вызывается (идет проверка ванильного, оттуда и ошибка)?

Или я тупой, или что-то не понял как надо, но не работает. Помогите. Может есть другое решение задачи?
 
Сверху