Trying to add armor

This commit is contained in:
Mohammad-Ali Minaie
2017-10-25 19:37:34 -04:00
parent a79a372729
commit 118ef3f90b
9 changed files with 349 additions and 36 deletions

View File

@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft
mod_version=1.4.0
mod_version=1.4.1
forge_version=14.23.0.2493
mcp_mappings=snapshot_20170624
mc_version=1.12.2

View File

@@ -17,7 +17,7 @@ public class ModInfo {
public static final String MOD_CONFIG = "primal/" + MOD_ID;
//public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.4.0";
public static final String MOD_VERSION = "1.4.1";
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.0,);";

View File

@@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@@ -15,6 +16,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.armor.CustomHelmet;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart;
@@ -132,7 +134,7 @@ public class ModItems {
public static Item unstrunglongbow;
public static Item longbow;
public static Item leatherhelmet;
//public static Item testleggings;
//public static Item forgingmanual;
@@ -258,7 +260,8 @@ public class ModItems {
/**********
ARMOR
**********/
//testleggings=new CustomLeggings(PrimalAPI.ToolMaterials.ARMOR_ADAMANT, 3, EntityEquipmentSlot.LEGS, "testleggings");
leatherhelmet=new CustomHelmet(PrimalAPI.ArmorMaterials.ARMOR_HIDE, 0, EntityEquipmentSlot.HEAD, "leatherhelmet");
//testleggings=new CustomHelmet(PrimalAPI.ToolMaterials.ARMOR_ADAMANT, 3, EntityEquipmentSlot.LEGS, "testleggings");
//registerItem(312, "diamond_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, EntityEquipmentSlot.LEGS)).setUnlocalizedName("leggingsDiamond"));
}
@@ -372,6 +375,7 @@ public class ModItems {
/**********
ARMOR
**********/
ForgeRegistries.ITEMS.register(leatherhelmet);
//ForgeRegistries.ITEMS.register(testleggings);
@@ -492,7 +496,7 @@ public class ModItems {
/**********
ARMOR
**********/
//registerRender(testleggings);
registerRender(leatherhelmet);
}

View File

@@ -0,0 +1,71 @@
package nmd.primal.forgecraft.items.armor;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.proxy.ClientProxy;
import javax.annotation.Nullable;
/**
* Created by mminaie on 7/3/17.
*/
public class CustomHelmet extends ItemArmor{
public CustomHelmet(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, String name) {
super(materialIn, renderIndexIn, equipmentSlotIn);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
public String getName() {
return this.getRegistryName().toString();
}
public static boolean isHidden()
{
return false;
}
@Nullable
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
{
//ModelBiped armorModel = ItemsRegister.armorModels.get(this);
ModelBiped armorModel = ClientProxy.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;
}
@Nullable
@Override
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{
return ModInfo.MOD_ID + ":textures/armor/hide.png";
}
}

View File

@@ -1,30 +0,0 @@
package nmd.primal.forgecraft.items.armor;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 7/3/17.
*/
public class CustomLeggings extends ItemArmor{
public CustomLeggings(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, String name) {
super(materialIn, renderIndexIn, equipmentSlotIn);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
public String getName() {
return this.getRegistryName().toString();
}
public static boolean isHidden()
{
return false;
}
}

View File

@@ -0,0 +1,253 @@
package nmd.primal.forgecraft.models;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
/**
* Created by mminaie on 10/25/17.
*/
public class ModelPlateHelmet extends ModelBiped
{
//fields
ModelRenderer head;
ModelRenderer body;
ModelRenderer rightarm;
ModelRenderer leftarm;
ModelRenderer rightleg;
ModelRenderer leftleg;
private ModelRenderer Shape1;
private ModelRenderer Shape2;
private ModelRenderer Shape3;
private ModelRenderer Shape4;
private ModelRenderer Shape5;
private ModelRenderer Shape6;
private ModelRenderer Shape7;
private ModelRenderer Shape8;
private ModelRenderer Shape9;
private ModelRenderer Shape10;
private ModelRenderer Shape11;
private ModelRenderer Shape12;
private ModelRenderer Shape13;
private ModelRenderer Shape14;
private ModelRenderer Shape15;
private ModelRenderer Shape16;
private ModelRenderer Shape17;
private ModelRenderer Shape18;
private ModelRenderer Shape19;
private ModelRenderer Shape20;
private ModelRenderer Shape21;
public ModelPlateHelmet(float scale)
{
//super(1.0f, 64, 64);
super(scale, 0.0f, 64, 64);
//textureWidth = 64;
//textureHeight = 64;
/*
head = new ModelRenderer(this, 0, 0);
head.addBox(-4F, -8F, -4F, 8, 8, 8);
head.setRotationPoint(0F, 0F, 0F);
head.setTextureSize(64, 64);
head.mirror = true;
setRotation(head, 0F, 0F, 0F);
/*
body = new ModelRenderer(this, 16, 16);
body.addBox(-4F, 0F, -2F, 8, 12, 4);
body.setRotationPoint(0F, 0F, 0F);
body.setTextureSize(64, 64);
body.mirror = true;
setRotation(body, 0F, 0F, 0F);
rightarm = new ModelRenderer(this, 40, 16);
rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);
rightarm.setRotationPoint(-5F, 2F, 0F);
rightarm.setTextureSize(64, 64);
rightarm.mirror = true;
setRotation(rightarm, 0F, 0F, 0F);
leftarm = new ModelRenderer(this, 40, 16);
leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);
leftarm.setRotationPoint(5F, 2F, 0F);
leftarm.setTextureSize(64, 64);
leftarm.mirror = true;
setRotation(leftarm, 0F, 0F, 0F);
rightleg = new ModelRenderer(this, 0, 16);
rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);
rightleg.setRotationPoint(-2F, 12F, 0F);
rightleg.setTextureSize(64, 64);
rightleg.mirror = true;
setRotation(rightleg, 0F, 0F, 0F);
leftleg = new ModelRenderer(this, 0, 16);
leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);
leftleg.setRotationPoint(2F, 12F, 0F);
leftleg.setTextureSize(64, 64);
leftleg.mirror = true;
setRotation(leftleg, 0F, 0F, 0F);
*/
Shape1 = new ModelRenderer(this, 0, 37);
Shape1.addBox(-4.5F, -7F, -5F, 4, 7, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = false;
setRotation(Shape1, 0F, 1.570796F, 0F);
Shape2 = new ModelRenderer(this, 52, 37);
Shape2.addBox(-4.5F, -7F, -5F, 4, 2, 1);
Shape2.setRotationPoint(0F, 0F, 0F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = false;
setRotation(Shape2, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 52, 40);
Shape3.addBox(-2F, -7F, -5.5F, 4, 2, 1);
Shape3.setRotationPoint(0F, 0F, 0F);
Shape3.setTextureSize(64, 64);
Shape3.mirror = false;
setRotation(Shape3, 0F, 0F, 0F);
Shape4 = new ModelRenderer(this, 52, 52);
Shape4.addBox(0.5F, -7F, -5F, 4, 2, 1);
Shape4.setRotationPoint(0F, 0F, 0F);
Shape4.setTextureSize(64, 64);
Shape4.mirror = false;
setRotation(Shape4, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 0, 37);
Shape5.addBox(0.5F, -7F, -5F, 4, 5, 1);
Shape5.setRotationPoint(0F, 0F, 0F);
Shape5.setTextureSize(64, 64);
Shape5.mirror = false;
setRotation(Shape5, 0F, 1.570796F, 0F);
Shape7 = new ModelRenderer(this, 5, 37);
Shape7.addBox(-2F, -7F, -5.5F, 4, 6, 1);
Shape7.setRotationPoint(0F, 0F, 0F);
Shape7.setTextureSize(64, 64);
Shape7.mirror = false;
setRotation(Shape7, 0F, 1.570796F, 0F);
Shape8 = new ModelRenderer(this, 2, 37);
Shape8.addBox(-2F, -7F, -5.5F, 4, 8, 1);
Shape8.setRotationPoint(0F, 0F, 0F);
Shape8.setTextureSize(64, 64);
Shape8.mirror = false;
setRotation(Shape8, 0F, 3.141593F, 0F);
Shape9 = new ModelRenderer(this, 5, 37);
Shape9.addBox(0.5F, -7F, -5F, 4, 7, 1);
Shape9.setRotationPoint(0F, 0F, 0F);
Shape9.setTextureSize(64, 64);
Shape9.mirror = false;
setRotation(Shape9, 0F, 3.141593F, 0F);
Shape10 = new ModelRenderer(this, 20, 37);
Shape10.addBox(-4.5F, -7F, -5F, 4, 5, 1);
Shape10.setRotationPoint(0F, 0F, 0F);
Shape10.setTextureSize(64, 64);
Shape10.mirror = false;
setRotation(Shape10, 0F, -1.570796F, 0F);
Shape11 = new ModelRenderer(this, 25, 37);
Shape11.addBox(-2F, -7F, -5.5F, 4, 6, 1);
Shape11.setRotationPoint(0F, 0F, 0F);
Shape11.setTextureSize(64, 64);
Shape11.mirror = false;
setRotation(Shape11, 0F, -1.570796F, 0F);
Shape12 = new ModelRenderer(this, 30, 37);
Shape12.addBox(0.5F, -7F, -5F, 4, 7, 1);
Shape12.setRotationPoint(0F, 0F, 0F);
Shape12.setTextureSize(64, 64);
Shape12.mirror = false;
setRotation(Shape12, 0F, -1.570796F, 0F);
Shape13 = new ModelRenderer(this, 10, 55);
Shape13.addBox(-2F, -11F, -2F, 4, 1, 4);
Shape13.setRotationPoint(0F, 0F, 0F);
Shape13.setTextureSize(64, 64);
Shape13.mirror = false;
setRotation(Shape13, 0F, 0F, 0F);
Shape14 = new ModelRenderer(this, 0, 46);
Shape14.addBox(-4.5F, -8F, -4.5F, 9, 1, 9);
Shape14.setRotationPoint(0F, 0F, 0F);
Shape14.setTextureSize(64, 64);
Shape14.mirror = false;
setRotation(Shape14, 0F, 0F, 0F);
Shape15 = new ModelRenderer(this, 0, 46);
Shape15.addBox(-3.5F, -10F, -3.5F, 7, 1, 7);
Shape15.setRotationPoint(0F, 0F, 0F);
Shape15.setTextureSize(64, 64);
Shape15.mirror = false;
setRotation(Shape15, 0F, 0F, 0F);
Shape16 = new ModelRenderer(this, 5, 50);
Shape16.addBox(-3F, -10.5F, -3F, 6, 1, 6);
Shape16.setRotationPoint(0F, 0F, 0F);
Shape16.setTextureSize(64, 64);
Shape16.mirror = false;
setRotation(Shape16, 0F, 0F, 0F);
Shape17 = new ModelRenderer(this, 50, 48);
Shape17.addBox(-1F, -8.5F, 3F, 2, 1, 5);
Shape17.setRotationPoint(0F, 0F, 0F);
Shape17.setTextureSize(64, 64);
Shape17.mirror = false;
setRotation(Shape17, 1.047198F, 3.141593F, 0F);
Shape18 = new ModelRenderer(this, 50, 48);
Shape18.addBox(-1F, -8.5F, 3F, 2, 1, 5);
Shape18.setRotationPoint(0F, 0F, 0F);
Shape18.setTextureSize(64, 64);
Shape18.mirror = false;
setRotation(Shape18, 1.047198F, 0F, 0F);
Shape19 = new ModelRenderer(this, 46, 51);
Shape19.addBox(-1F, -11.5F, -3.5F, 2, 1, 7);
Shape19.setRotationPoint(0F, 0F, 0F);
Shape19.setTextureSize(64, 64);
Shape19.mirror = false;
setRotation(Shape19, 0F, 0F, 0F);
Shape20 = new ModelRenderer(this, 40, 48);
Shape20.addBox(-1F, -5F, -5.5F, 2, 3, 1);
Shape20.setRotationPoint(0F, 0F, 0F);
Shape20.setTextureSize(64, 64);
Shape20.mirror = false;
setRotation(Shape20, 0F, 0F, 0F);
Shape21 = new ModelRenderer(this, 0, 45);
Shape21.addBox(-4F, -9F, -4F, 8, 1, 8);
Shape21.setRotationPoint(0F, 0F, 0F);
Shape21.setTextureSize(64, 64);
Shape21.mirror = false;
setRotation(Shape21, 0F, 0F, 0F);
Shape6 = new ModelRenderer(this, 36, 37);
Shape6.addBox(0.5F, -7F, -5F, 4, 7, 1);
Shape6.setRotationPoint(0F, 0F, 0F);
Shape6.setTextureSize(64, 64);
Shape6.mirror = true;
setRotation(Shape6, 0F, 3.141593F, 0F);
bipedHead.addChild(Shape1);
bipedHead.addChild(Shape2);
bipedHead.addChild(Shape3);
bipedHead.addChild(Shape4);
bipedHead.addChild(Shape5);
bipedHead.addChild(Shape7);
bipedHead.addChild(Shape8);
bipedHead.addChild(Shape9);
bipedHead.addChild(Shape10);
bipedHead.addChild(Shape11);
bipedHead.addChild(Shape12);
bipedHead.addChild(Shape13);
bipedHead.addChild(Shape14);
bipedHead.addChild(Shape15);
bipedHead.addChild(Shape16);
bipedHead.addChild(Shape17);
bipedHead.addChild(Shape18);
bipedHead.addChild(Shape19);
bipedHead.addChild(Shape20);
bipedHead.addChild(Shape21);
bipedHead.addChild(Shape6);
}
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;
}
}

View File

@@ -1,16 +1,24 @@
package nmd.primal.forgecraft.proxy;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.item.Item;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.models.ModelPlateHelmet;
import nmd.primal.forgecraft.renders.blocks.*;
import nmd.primal.forgecraft.tiles.*;
import java.util.HashMap;
import java.util.Map;
/**
* Created by kitsu on 11/26/2016.
*/
public class ClientProxy implements CommonProxy {
public static final Map<Item, ModelBiped> armorModels = new HashMap<Item, ModelBiped>();
@Override
public void preInit(){
ModItems.registerCustomRenders();
@@ -38,6 +46,13 @@ public class ClientProxy implements CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingBlock.class, new TileCastingBlockRender());
}
public void registerModels(){
ModelPlateHelmet custom_armor = new ModelPlateHelmet(1.0f);
armorModels.put(ModItems.leatherhelmet, custom_armor);
}
@Override
public void registerModelBakeryVariants(){
//ModelBakery.registerItemVariants(ModItems.stonetongs, new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -2,7 +2,7 @@
"modid": "forgecraft",
"name": "Kitsu's Forgecraft",
"description": "Forged with sweat and blood",
"version": "1.3.25",
"version": "1.4.1",
"mcversion": "1.12.1",
"url": "",
"updateUrl": "",