Jump to content

[1.11.2] Rendering Mob Textures


Paladin

Recommended Posts

So I'm trying to render some textures for this one mob I've created, however I can't seem to get it to render the appropriate based off the gender of the mob.

 

public ResourceLocation getSkin() {
		if(!this.world.isRemote){
			if(this.isFemale){
				return HUMAN_TEXTURES_FEMALE;
			}else{
				if(this.prof == prof.soldier){
					return HUMAN_TEXTURES;
				}else{
					return HUMAN_TEXTURES;
				}
			}
		}else{
			return new ResourceLocation("minecraft:textures/entity/steve.png");
		}
	}

 

Right now the only texture that renders in-game is the steve texture, and when I remove 

if(!this.world.isRemote){

The textures won't render on the correct type of mob... For example a female texture rendering on a male-only soldier mob.

 

Is there any way to resolve this?


Additional Code :

Spoiler

 

 


public EntityHuman(World world){
		super(world);
		int choice = 0;
		
		if(world.rand.nextInt(100) <= 25){
			//init(world, EntityHuman.getRandomName(), HumanProfession.peasant, HumanFaction.Tifguardians, CombatType.Melee, false);			
			choice = 1;
		} else if(world.rand.nextInt(100) <= 25){
			//init(world, EntityHuman.getRandomNameFemale(), HumanProfession.peasant, HumanFaction.Tifguardians, CombatType.Melee, true);			
			choice = 6;
		}else if(world.rand.nextInt(100) <= 35){
			//init(world , EntityHuman.getRandomName(), HumanProfession.farmer, HumanFaction.Tifguardians, CombatType.Melee, false);			
			choice = 3;
		}else if(world.rand.nextInt(100) <= 35){
			//init(world, EntityHuman.getRandomNameFemale(), HumanProfession.farmer, HumanFaction.Tifguardians, CombatType.Melee, true);			
			choice = 4;
		}else if(world.rand.nextInt(100) <= 75){
			//init(world, EntityHuman.getRandomName(), HumanProfession.soldier, HumanFaction.Tifguardians, CombatType.Melee, false);
			choice = 5;
		}else{
			//init(world, EntityHuman.getRandomName(), HumanProfession.archer, HumanFaction.Tifguardians, CombatType.Ranged, false);	
			choice = 2;
		}
		
		//choice = 5;
		
		switch(choice){
		case 0:
			break;
		case 1:
			init(world, EntityHuman.getRandomName(), HumanProfession.peasant, HumanFaction.Tifguardians, CombatType.Melee, false);	
			break;
		case 2:
			init(world, EntityHuman.getRandomNameFemale(), HumanProfession.peasant, HumanFaction.Tifguardians, CombatType.Melee, true);			
			
			break;
		case 3:
			init(world , EntityHuman.getRandomName(), HumanProfession.farmer, HumanFaction.Tifguardians, CombatType.Melee, false);			
			
			break;
		case 4:
			init(world, EntityHuman.getRandomNameFemale(), HumanProfession.farmer, HumanFaction.Tifguardians, CombatType.Melee, true);			
			
			break;
		case 5:
			init(world, EntityHuman.getRandomName(), HumanProfession.soldier, HumanFaction.Tifguardians, CombatType.Melee, false);
			
			break;
		case 6:
			init(world, EntityHuman.getRandomName(), HumanProfession.archer, HumanFaction.Tifguardians, CombatType.Ranged, false);	
			
			break;
		}
 }

 


	private void init(World world, String name, HumanProfession prof,
			HumanFaction f, CombatType c, boolean gender, int[] Offsets) {
		// TODO Auto-generated method stub
		this.setTitle(name);
		this.setProf(prof);
		this.faction = f;
		this.combatType = c;
		this.setFemale(gender);
	
		this.speedOffset = Offsets[0];
		this.healthOffset = Offsets[1];
		this.attackOffset = Offsets[2];
		this.armorToughOffset = Offsets[3];
		this.attackSpeedOffset = Offsets[4];
		this.followRangeOffset = Offsets[5];
		this.resistanceOffset = Offsets[6];
		this.armorOffset = Offsets[7];
		this.luckOffset = Offsets[8];
		
	//	System.out.println("1 "+title+" "+this.isFemale+" "+this.prof);
		if(!world.isRemote){
			init();
		}else{
			this.setProfession(new Profession("SLAVE", -2));
		}
	}

 


	protected void init(){
		if(!wasInit){
		
		
			if(getProf() == getProf().soldier){
			//	System.out.println("2 "+this.getTitle()+" "+this.isFemale+" "+this.getProf());
				this.setProfession(new Profession("Soldier", 0));
				this.setCustomNameTag(getTitle()+" - "+this.getHumanProfession().getName());
				if(this.faction == HumanFaction.Tifguardians){
					this.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.IRON_SWORD));
					this.setHeldItem(EnumHand.OFF_HAND, new ItemStack(Items.SHIELD));
					this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.CHAINMAIL_HELMET));
					this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(Items.IRON_CHESTPLATE));
					this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(Items.IRON_LEGGINGS));
					this.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(Items.IRON_BOOTS));
				}else if(this.faction == HumanFaction.Bandits){
					
				}else{
					
				}
		        this.setCombatTask();
			}else if(getProf() == getProf().archer){
				this.setProfession(new Profession("Archer", 1));
				this.setCustomNameTag(getTitle()+" - "+this.getHumanProfession().getName());
				if(this.faction == HumanFaction.Tifguardians){
					this.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.BOW));
					this.setHeldItem(EnumHand.OFF_HAND, new ItemStack(Items.TIPPED_ARROW));
					this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.CHAINMAIL_HELMET));
					this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(Items.LEATHER_CHESTPLATE));
					this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(Items.LEATHER_LEGGINGS));
					this.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(Items.LEATHER_BOOTS));
				}else if(this.faction == HumanFaction.Bandits){
					
				}else{
					
				}
		        this.setCombatTask();
			}else if(getProf() == getProf().farmer){
				this.setProfession(new Profession("Farmer", 2));
				this.setCustomNameTag(getTitle()+" - "+this.getHumanProfession().getName());
				if(this.faction == HumanFaction.Tifguardians){
					this.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.IRON_HOE));
				}else if(this.faction == HumanFaction.Bandits){
					
				}else{
					
				}
				this.tasks.addTask(6, new EntityAIHarvestFarmland(this, 0.6D));
				this.tasks.addTask(2, new EntityAIMoveIndoors(this));
			}else if(getProf() == getProf().peasant){
				this.setProfession(new Profession("Peasant", 3));
				this.setCustomNameTag(getTitle()+" - "+this.getHumanProfession().getName());
				if(this.faction == HumanFaction.Tifguardians){
					//this.setHeldItem(EnumHand.MAIN_HAND, null);
				}else if(this.faction == HumanFaction.Bandits){
					
				}else{
					
				}
				this.tasks.addTask(6, new EntityAIHarvestFarmland(this, 0.6D));
				this.tasks.addTask(2, new EntityAIMoveIndoors(this));
			}else{
				this.setProfession(new Profession("Villager", -1));
				this.setCustomNameTag(getTitle()+" - "+this.getHumanProfession().getName());
				if(this.faction == HumanFaction.Tifguardians){
	
				}else if(this.faction == HumanFaction.Bandits){
					
				}else{
					
				}
				this.tasks.addTask(2, new EntityAIMoveIndoors(this));
			}
			wasInit = true;
		}
		
		
		System.out.println(this+" "+world.isRemote+" "+this.isFemale);
	}

 

 

Any help is greatly appreciated.

 

 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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