Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

 

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.