Jump to content

Recommended Posts

Posted

How it is supposed to look:
https://gyazo.com/f18f503fe76722d5f287d7c8426fded3

how it looks :(:
https://gyazo.com/d6fc59f52a90ad7edd63092ae0657548
Well, let me explain what is the problem if you cant read it from the pictures, i am trying to make a 3d armor model with a texture, the texture is not loading, and the armor is loading twice (one with a wrong offset), the one with the wrong offset is animated but the one that is correctly placed isnt.

common proxy:

 

package com.walkingdead.walkingdeadmod;

import com.walkingdead.walkingdeadmod.armor.model.MilitairycamoArmor;
import com.walkingdead.walkingdeadmod.eventhandlers.RenderGuiHandler;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.blood.Blood;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.blood.BloodStorage;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.blood.Bloodlevel;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.blood.CapabilityHandler;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.water.Water;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.water.WaterCapabilityHandler;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.water.WaterStorage;
import com.walkingdead.walkingdeadmod.eventhandlers.playerdata.water.Waterlevel;

import net.minecraft.client.model.ModelBiped;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.CapabilityManager;

public class CommonProxyTestEnvironmentMod {
	
	private static final MilitairycamoArmor CamoArmorChest2 = new MilitairycamoArmor(1.0F);
	private static final MilitairycamoArmor CamoArmor = new MilitairycamoArmor(0.5F);
	
	
	public ModelBiped getArmorModel(int id) {
	return null;	
	}
	
	
	public void registerRenderers(WalkingDeadMod ins) {

	}
	
	public void Eventstartup() {
	MinecraftForge.EVENT_BUS.register(new RenderGuiHandler());
	
	
	MinecraftForge.EVENT_BUS.register(new CapabilityHandler());
	MinecraftForge.EVENT_BUS.register(new WaterCapabilityHandler());
	
	
	CapabilityManager.INSTANCE.register(Bloodlevel.class, new BloodStorage(), Blood.class);
	CapabilityManager.INSTANCE.register(Waterlevel.class, new WaterStorage(), Water.class);
	
	
	}
	
}

client proxy:

package com.walkingdead.walkingdeadmod;

import com.walkingdead.walkingdeadmod.armor.ModArmor;
import com.walkingdead.walkingdeadmod.armor.armor.CamoArmor;
import com.walkingdead.walkingdeadmod.armor.model.MilitairycamoArmor;
import com.walkingdead.walkingdeadmod.blocks.ModBlocks;
import com.walkingdead.walkingdeadmod.food.ModFood;
import com.walkingdead.walkingdeadmod.items.ModItems;
import com.walkingdead.walkingdeadmod.weapons.ModTools;
import com.walkingdead.walkingdeadmod.weapons.projectiles.EntityHardenedSharpStick;
import com.walkingdead.walkingdeadmod.weapons.projectiles.EntitySharpStick;
import com.walkingdead.walkingdeadmod.weapons.projectiles.EntityStick;
import com.walkingdead.walkingdeadmod.weapons.projectiles.renderers.RenderHardenedSharpStick;
import com.walkingdead.walkingdeadmod.weapons.projectiles.renderers.RenderSharpStick;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.client.registry.RenderingRegistry;

public class ClientProxyTestEnvironmentMod extends CommonProxyTestEnvironmentMod {

	@Override
	public void registerRenderers(WalkingDeadMod ins) {
		OBJLoader.INSTANCE.addDomain(WalkingDeadMod.MODID);
		//mobs
		ins.Crawler.registerRenderers();
		ins.Runner.registerRenderers();
		ins.Anatomy.registerRenderers();
		ins.Medical.registerRenderers();
		ins.civ1.registerRenderers();
		ins.Police1.registerRenderers();
		ins.doctor.registerRenderers();
		
		//tools
		ModTools.registerRenders();
		
		//items
		
		ModItems.registerRenders();
		
		//blocks
		ModBlocks.registerRenders();
		
		ModArmor.registerRenders();
		
		//food
		ModFood.registerRenders();
		
		//projectiles
		RenderingRegistry.registerEntityRenderingHandler(EntitySharpStick.class, new RenderSharpStick(Minecraft.getMinecraft().getRenderManager(), ModTools.sharpstick, Minecraft.getMinecraft().getRenderItem()));
		RenderingRegistry.registerEntityRenderingHandler(EntityStick.class, new RenderSharpStick(Minecraft.getMinecraft().getRenderManager(), ModTools.stick, Minecraft.getMinecraft().getRenderItem()));
		RenderingRegistry.registerEntityRenderingHandler(EntityHardenedSharpStick.class, new RenderHardenedSharpStick(Minecraft.getMinecraft().getRenderManager(), ModTools.hardenedsharpstick, Minecraft.getMinecraft().getRenderItem()));
	}
	
	
	private static final MilitairycamoArmor CamoArmorChest = new MilitairycamoArmor(1.0F);
	private static final MilitairycamoArmor CamoArmor = new MilitairycamoArmor(0.5F);
	
	
	public ModelBiped getArmorModel(int id) {
	switch (id) {
	case 0:
	return CamoArmorChest;
	case 1:
	return CamoArmor;
	}
	return null;	
	}
	
	
}

 

model:

 

package com.walkingdead.walkingdeadmod.armor.model;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class MilitairycamoArmor extends ModelBiped
{
  //fields
    private ModelRenderer pocketright;
    private ModelRenderer helmetband;
    private ModelRenderer pocketleft;
    private ModelRenderer helmet1;
    private ModelRenderer body;
    private ModelRenderer rightarm;
    private ModelRenderer leftarm;
    private ModelRenderer rightleg;
    private ModelRenderer leftleg;
    private ModelRenderer helmet2;
    private ModelRenderer helmet3;
    private ModelRenderer helmet4;
    private ModelRenderer helmet5;
    private ModelRenderer kneecapright;
    private ModelRenderer kneecapleft;
    private ModelRenderer bodyarmorbottom;
    private ModelRenderer bodyarmortop;
    private ModelRenderer helmet6;
   
    
  
  public MilitairycamoArmor(float scale)
  {
	  super(scale, 0, 0, 0);
	  
	  textureWidth = 128;
	  textureHeight = 128;
    
      pocketright = new ModelRenderer(this, 0, 123);
      pocketright.addBox(0F, 0F, 0F, 2, 3, 2);
      pocketright.setRotationPoint(-1F, 1.5F, -4F);
      pocketright.setTextureSize(128, 128);
      pocketright.mirror = true;
      setRotation(pocketright, 0F, 0F, 0F);
      helmetband = new ModelRenderer(this, 92, 0);
      helmetband.addBox(0F, 0F, 0F, 9, 1, 9);
      helmetband.setRotationPoint(-4.5F, 0F, -4.3F);
      helmetband.setTextureSize(128, 128);
      helmetband.mirror = true;
      setRotation(helmetband, 0.8266561F, 0F, 0F);
      pocketleft = new ModelRenderer(this, 0, 123);
      pocketleft.addBox(0F, 0F, 0F, 2, 3, 2);
      pocketleft.setRotationPoint(1.5F, 1.5F, -4F);
      pocketleft.setTextureSize(128, 128);
      pocketleft.mirror = true;
      setRotation(pocketleft, 0F, 0F, 0F);
      helmet1 = new ModelRenderer(this, 0, 56);
      helmet1.addBox(0F, 0F, 0F, 10, 3, 10);
      helmet1.setRotationPoint(-5F, -9F, -5F);
      helmet1.setTextureSize(128, 128);
      helmet1.mirror = true;
      setRotation(helmet1, 0F, 0F, 0F);
      body = new ModelRenderer(this, 100, 16);
      body.addBox(-4F, 0F, -2F, 8, 12, 6);
      body.setRotationPoint(0F, 0F, -1F);
      body.setTextureSize(128, 128);
      body.mirror = true;
      setRotation(body, 0F, 0F, 0F);
      rightarm = new ModelRenderer(this, 40, 16);
      rightarm.addBox(-3F, -2F, -2F, 5, 13, 5);
      rightarm.setRotationPoint(-6F, 1.533333F, -0.5F);
      rightarm.setTextureSize(128, 128);
      rightarm.mirror = true;
      setRotation(rightarm, 0F, 0F, 0F);
      leftarm = new ModelRenderer(this, 40, 16);
      leftarm.addBox(-1F, -2F, -2F, 5, 13, 5);
      leftarm.setRotationPoint(5F, 2F, -0.5F);
      leftarm.setTextureSize(128, 128);
      leftarm.mirror = true;
      setRotation(leftarm, 0F, 0F, 0F);
      rightleg = new ModelRenderer(this, 0, 16);
      rightleg.addBox(-2F, 0F, -2F, 5, 12, 5);
      rightleg.setRotationPoint(-3F, 12F, -0.5F);
      rightleg.setTextureSize(128, 128);
      rightleg.mirror = true;
      setRotation(rightleg, 0F, 0F, 0F);
      leftleg = new ModelRenderer(this, 0, 16);
      leftleg.addBox(-2F, 0F, -2F, 5, 12, 5);
      leftleg.setRotationPoint(2F, 12F, -0.5F);
      leftleg.setTextureSize(128, 128);
      leftleg.mirror = true;
      setRotation(leftleg, 0F, 0F, 0F);
      helmet2 = new ModelRenderer(this, 0, 70);
      helmet2.addBox(0F, 0F, 0F, 10, 1, 6);
      helmet2.setRotationPoint(-5F, -6F, -1F);
      helmet2.setTextureSize(128, 128);
      helmet2.mirror = true;
      setRotation(helmet2, 0F, 0F, 0F);
      helmet3 = new ModelRenderer(this, 0, 49);
      helmet3.addBox(0F, 0F, 0F, 10, 1, 5);
      helmet3.setRotationPoint(-5F, -5F, 0F);
      helmet3.setTextureSize(128, 128);
      helmet3.mirror = true;
      setRotation(helmet3, 0F, 0F, 0F);
      helmet4 = new ModelRenderer(this, 0, 43);
      helmet4.addBox(0F, 0F, 0F, 10, 1, 4);
      helmet4.setRotationPoint(-5F, -4F, 1F);
      helmet4.setTextureSize(128, 128);
      helmet4.mirror = true;
      setRotation(helmet4, 0F, 0F, 0F);
      helmet5 = new ModelRenderer(this, 0, 38);
      helmet5.addBox(0F, 0F, 0F, 10, 1, 3);
      helmet5.setRotationPoint(-5F, -3F, 2F);
      helmet5.setTextureSize(128, 128);
      helmet5.mirror = true;
      setRotation(helmet5, 0F, 0F, 0F);
      kneecapright = new ModelRenderer(this, 47, 0);
      kneecapright.addBox(0F, 0F, 0F, 2, 4, 1);
      kneecapright.setRotationPoint(-3.5F, 16F, -3F);
      kneecapright.setTextureSize(128, 128);
      kneecapright.mirror = true;
      setRotation(kneecapright, 0F, 0F, 0F);
      kneecapleft = new ModelRenderer(this, 47, 0);
      kneecapleft.addBox(0F, 0F, 0F, 2, 4, 1);
      kneecapleft.setRotationPoint(1.5F, 16F, -3F);
      kneecapleft.setTextureSize(128, 128);
      kneecapleft.mirror = true;
      setRotation(kneecapleft, 0F, 0F, 0F);
      bodyarmorbottom = new ModelRenderer(this, 61, 42);
      bodyarmorbottom.addBox(0F, 0F, 0F, 6, 1, 6);
      bodyarmorbottom.setRotationPoint(-3F, 12F, -3F);
      bodyarmorbottom.setTextureSize(128, 128);
      bodyarmorbottom.mirror = true;
      setRotation(bodyarmorbottom, 0F, 0F, 0F);
      bodyarmortop = new ModelRenderer(this, 51, 58);
      bodyarmortop.addBox(0F, 0F, 0F, 6, 8, 7);
      bodyarmortop.setRotationPoint(-3F, 2F, -3.5F);
      bodyarmortop.setTextureSize(128, 128);
      bodyarmortop.mirror = true;
      setRotation(bodyarmortop, 0F, 0F, 0F);
      helmet6 = new ModelRenderer(this, 0, 80);
      helmet6.addBox(0F, 0F, 0F, 10, 2, 1);
      helmet6.setRotationPoint(-5F, -2F, 4F);
      helmet6.setTextureSize(128, 128);
      helmet6.mirror = true;
      setRotation(helmet6, 0F, 0F, 0F);
      
      bipedBody.addChild(pocketright);
      bipedHead.addChild(helmetband);
      bipedBody.addChild(pocketleft);
      bipedHead.addChild(helmet1);
      bipedBody.addChild(body);
      bipedRightArm.addChild(rightarm);
      bipedLeftArm.addChild(leftarm);
      bipedRightLeg.addChild(rightleg);
      bipedLeftLeg.addChild(leftleg);
      bipedHead.addChild(helmet2);
      bipedHead.addChild(helmet3);
      bipedHead.addChild(helmet4);
      bipedHead.addChild(helmet5);
      bipedHead.addChild(helmet6);
      bipedLeftLeg.addChild(kneecapleft);
      bipedRightLeg.addChild(kneecapright);
      bipedBody.addChild(bodyarmorbottom);
      bipedBody.addChild(bodyarmortop);     
      }
  
  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);
    pocketright.render(f5);
    helmetband.render(f5);
    pocketleft.render(f5);
    helmet1.render(f5);
    body.render(f5);
    rightarm.render(f5);
    leftarm.render(f5);
    rightleg.render(f5);
    leftleg.render(f5);
    helmet2.render(f5);
    helmet3.render(f5);
    helmet4.render(f5);
    helmet5.render(f5);
    kneecapright.render(f5);
    kneecapleft.render(f5);
    bodyarmorbottom.render(f5);
    bodyarmortop.render(f5);
    helmet6.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
}

armor.class:

package com.walkingdead.walkingdeadmod.armor.armor;

import com.walkingdead.walkingdeadmod.WalkingDeadMod;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class CamoArmor extends ItemArmor{

	public CamoArmor(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, String unlocalizedName) {
		super(materialIn, renderIndexIn, equipmentSlotIn);
		this.setUnlocalizedName(unlocalizedName);
		this.setCreativeTab(WalkingDeadMod.WalkingDead);
		this.setRegistryName(new ResourceLocation(WalkingDeadMod.MODID, unlocalizedName));
	}

	
	@Override 	
	@SideOnly(Side.CLIENT)
		public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot,
				ModelBiped defaultModel) {

			if (itemStack != null) {
				if (itemStack.getItem() instanceof ItemArmor) {

					EntityEquipmentSlot type = ((ItemArmor) itemStack.getItem()).armorType;
					ModelBiped armorModel = null;
					switch (type) {
					case HEAD:
					case LEGS:
					armorModel = WalkingDeadMod.proxy.getArmorModel(0);
					break;
					case FEET:
					case CHEST:
					armorModel = WalkingDeadMod.proxy.getArmorModel(1);
					break;
					default:
						break;
					}

					armorModel.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD;
					armorModel.bipedHeadwear.showModel = armorSlot == EntityEquipmentSlot.HEAD;
					armorModel.bipedBody.showModel = (armorSlot == EntityEquipmentSlot.CHEST)
							|| (armorSlot == EntityEquipmentSlot.CHEST);
					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 = defaultModel.isSneak;
					armorModel.isRiding = defaultModel.isRiding;
					armorModel.isChild = defaultModel.isChild;
					armorModel.rightArmPose = defaultModel.rightArmPose;
					armorModel.leftArmPose = defaultModel.leftArmPose;

					return armorModel;
				}
			}
			return null;
	}
}

 

armor registry:

 


 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.