- 35
- 0
Доброго времени суток. На данный момент прохожу учебник. Застрял на этом этапе. Все делал следуя инструкции, но по итогу получил такую картину(скриншот прикреплен), модель брони делал самостоятельно. Возможно дело в этом
Текстуры сохранил по пути ht/textures/models/armor/armor_model_layer_1, ht/textures/models/armor/armor_model_layer_2 . Текстуры так же прикрепил, вдруг дело в них.
Буду благодарен за любую помощь
Текстуры сохранил по пути ht/textures/models/armor/armor_model_layer_1, ht/textures/models/armor/armor_model_layer_2 . Текстуры так же прикрепил, вдруг дело в них.
Буду благодарен за любую помощь
Класс регистрации брони:
public class InitItems {
public static final List<Item> ITEMS = new ArrayList<Item>();
public static final ItemArmor.ArmorMaterial armorMaterial = EnumHelper.addArmorMaterial("ht:armor_model", "ht:armor_model", 9, new int[]{2, 4, 6, 3}, 7, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 2.0F).setRepairItem(new ItemStack(Item.getItemFromBlock(Blocks.OBSIDIAN)));
public static Item
BOOTS = new ItemMagicArmor("boots", armorMaterial, 1, EntityEquipmentSlot.FEET),
LEGS = new ItemMagicArmor("legs", armorMaterial, 2, EntityEquipmentSlot.LEGS),
CHESTPLATE = new ItemMagicArmor("chestplate", armorMaterial, 1, EntityEquipmentSlot.CHEST),
HEAD = new ItemMagicArmor("head", armorMaterial, 1, EntityEquipmentSlot.HEAD);
public static final Map<Item, ModelBiped> armorModels = new HashMap<>();
public static void register()
{
ArmorModel
HeadModel = new ArmorModel(0),
ArmorModel = new ArmorModel(1),
LeggsModel = new ArmorModel(2),
BootsModel = new ArmorModel(3);
armorModels.put(HEAD, HeadModel);
armorModels.put(CHESTPLATE, ArmorModel);
armorModels.put(LEGS, LeggsModel);
armorModels.put(BOOTS, BootsModel);
}
}
Класс брони:
public class ItemMagicArmor extends ItemArmor
{
public ItemMagicArmor(String name, ItemArmor.ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn)
{
super(materialIn, renderIndexIn, equipmentSlotIn);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(Main.HEAVENLY_TABS);
InitItems.ITEMS.add(this);
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped model)
{
ModelBiped armorModel = InitItems.armorModels.get(this);
if (armorModel != null)
{
armorModel.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD;
armorModel.bipedHeadwear.showModel = false;
armorModel.bipedBody.showModel = armorSlot == EntityEquipmentSlot.CHEST || armorSlot == EntityEquipmentSlot.LEGS;
armorModel.bipedRightArm.showModel = armorSlot == EntityEquipmentSlot.CHEST;
armorModel.bipedLeftArm.showModel = armorSlot == EntityEquipmentSlot.CHEST;
armorModel.bipedRightLeg.showModel = armorSlot == EntityEquipmentSlot.LEGS || armorSlot == EntityEquipmentSlot.FEET;
armorModel.bipedLeftLeg.showModel = armorSlot == EntityEquipmentSlot.LEGS || armorSlot == EntityEquipmentSlot.FEET;
armorModel.isSneak = entityLiving.isSneaking();
armorModel.isRiding = entityLiving.isRiding();
armorModel.isChild = entityLiving.isChild();
}
return armorModel;
}
}
Класс модели:
public class ArmorModel extends ModelBiped
{
private final ModelRenderer Head;
private final ModelRenderer cube_r1;
private final ModelRenderer cube_r2;
private final ModelRenderer Body;
private final ModelRenderer RightArm;
private final ModelRenderer cube_r5;
private final ModelRenderer cube_r6;
private final ModelRenderer LeftArm;
private final ModelRenderer RightLeg;
private final ModelRenderer LeftLeg;
private final ModelRenderer RightBoot;
private final ModelRenderer LeftBoot;
public ArmorModel(int type)
{
super(0, 0, 128, 128);
Head = new ModelRenderer(this);
Head.setRotationPoint(0.0F, 0.0F, 0.0F);
Head.cubeList.add(new ModelBox(Head, 0, 223, -4.0F, -8.0F, -4.0F, 8, 6, 8, 0.49F, false));
Head.cubeList.add(new ModelBox(Head, 28, 207, -4.0F, -2.8F, 1.0F, 8, 3, 3, 0.4F, false));
Head.cubeList.add(new ModelBox(Head, 36, 218, 2.0F, -9.0F, -4.0F, 2, 8, 8, 0.5F, false));
Head.cubeList.add(new ModelBox(Head, 36, 241, -1.0F, -9.0F, -4.0F, 2, 7, 8, 0.48F, false));
Head.cubeList.add(new ModelBox(Head, 0, 201, -4.0F, -9.0F, -4.0F, 2, 8, 8, 0.5F, false));
cube_r1 = new ModelRenderer(this);
cube_r1.setRotationPoint(-6.0F, -1.0F, 1.0F);
Head.addChild(cube_r1);
setRotation(cube_r1, 0.3491F, 0.0F, 0.0F);
cube_r1.cubeList.add(new ModelBox(cube_r1, 67, 218, 3.0F, -6.0F, -1.3F, -1, 6, 6, 0.5F, false));
cube_r1.cubeList.add(new ModelBox(cube_r1, 66, 231, 10.0F, -6.0F, -1.3F, -1, 6, 6, 0.5F, false));
cube_r2 = new ModelRenderer(this);
cube_r2.setRotationPoint(-2.0F, -7.75F, -3.5F);
Head.addChild(cube_r2);
setRotation(cube_r2, 0.0F, -0.4363F, -1.5708F);
cube_r2.cubeList.add(new ModelBox(cube_r2, 84, 243, 1.02F, -2.05F, -1.0F, 1, 2, 4, 0.4F, false));
cube_r2.cubeList.add(new ModelBox(cube_r2, 84, 243, 1.02F, 4.05F, -1.0F, 1, 2, 4, 0.4F, false));
Body = new ModelRenderer(this);
Body.setRotationPoint(0.0F, 0.0F, 0.0F);
Body.cubeList.add(new ModelBox(Body, 30, 3, -4.0F, 0.0F, -2.0F, 8, 12, 4, 0.75F, false));
Body.cubeList.add(new ModelBox(Body, 40, 25, 1.25F, 2.0F, 0.25F, 2, 2, 2, 0.0F, false));
Body.cubeList.add(new ModelBox(Body, 54, 25, -3.25F, 2.0F, 0.25F, 2, 2, 2, 0.0F, false));
RightArm = new ModelRenderer(this);
RightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
RightArm.cubeList.add(new ModelBox(RightArm, 3, 37, -3.0F, -2.0F, -2.0F, 4, 12, 4, 0.49F, false));
RightArm.cubeList.add(new ModelBox(RightArm, 82, 22, -3.0F, -2.0F, 0.25F, 2, 11, 1, 0.5F, false));
RightArm.cubeList.add(new ModelBox(RightArm, 16, 57, -3.0F, -2.0F, -1.5F, 2, 11, 1, 0.5F, false));
cube_r5 = new ModelRenderer(this);
cube_r5.setRotationPoint(0.0F, 7.0F, 0.0F);
RightArm.addChild(cube_r5);
setRotation(cube_r5, 0.0F, 0.0F, 0.2618F);
cube_r6 = new ModelRenderer(this);
cube_r6.setRotationPoint(1.0F, 2.0F, 0.0F);
RightArm.addChild(cube_r6);
setRotation(cube_r6, 0.0F, 0.0F, -0.3054F);
LeftArm = new ModelRenderer(this);
LeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
LeftArm.cubeList.add(new ModelBox(LeftArm, 45, 37, -1.0F, -2.0F, -2.0F, 4, 12, 4, 0.49F, false));
LeftArm.cubeList.add(new ModelBox(LeftArm, 26, 58, 1.0F, -2.0F, -1.5F, 2, 11, 1, 0.5F, false));
LeftArm.cubeList.add(new ModelBox(LeftArm, 6, 57, 1.0F, -2.0F, 0.25F, 2, 11, 1, 0.5F, false));
RightLeg = new ModelRenderer(this);
RightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
RightLeg.cubeList.add(new ModelBox(RightLeg, 215, 24, -2.0F, 0.0F, -2.0F, 4, 9, 4, 0.5F, false));
LeftLeg = new ModelRenderer(this);
LeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
LeftLeg.cubeList.add(new ModelBox(LeftLeg, 215, 3, -2.0F, 0.0F, -2.0F, 4, 9, 4, 0.5F, false));
RightBoot = new ModelRenderer(this);
RightBoot.setRotationPoint(-1.9F, 12.0F, 0.0F);
RightBoot.cubeList.add(new ModelBox(RightBoot, 234, 44, -2.0F, 7.0F, -2.0F, 4, 5, 4, 0.75F, false));
RightBoot.cubeList.add(new ModelBox(RightBoot, 182, 10, -1.5F, 7.0F, 1.0F, 1, 3, 2, 0.5F, false));
RightBoot.cubeList.add(new ModelBox(RightBoot, 179, 32, -0.25F, 7.0F, 1.0F, 1, 3, 2, 0.5F, false));
LeftBoot = new ModelRenderer(this);
LeftBoot.setRotationPoint(1.9F, 12.0F, 0.0F);
LeftBoot.cubeList.add(new ModelBox(LeftBoot, 191, 28, -2.0F, 7.0F, -2.0F, 4, 5, 4, 0.75F, false));
LeftBoot.cubeList.add(new ModelBox(LeftBoot, 193, 9, -0.8F, 7.0F, 1.0F, 1, 3, 2, 0.5F, false));
LeftBoot.cubeList.add(new ModelBox(LeftBoot, 181, 21, 0.45F, 7.0F, 1.0F, 1, 3, 2, 0.5F, false));
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}