Jump to content

Can Certain Players have different textures than others?


MrProg

Recommended Posts

I want to add a dontator like benefit feature where if you donate, a hat that I have in the mod will be gold rather than red. The problem is that if you're a donator, you see your hat and everyone else's as gold and if youre not a donator you see your and everyone else's hat as red or at least I tried doing it. So is there a way where every player on a server will see a donator's hat as gold even if they're not a donator and they're will stay red? I know Aether II developers did something like that with Moa textures so it must be possible. Thanks!

 

My current code for the Hat to swap textures:

public class ArmorSantaHat extends ItemArmor {

public ArmorSantaHat(int par1, EnumArmorMaterial par2EnumArmorMaterial,
		int par3, int par4) {
		super(par1, par2EnumArmorMaterial, par3, par4);
	this.setCreativeTab(Wintercraft.WintercraftTab);
}

public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
        par3List.add("\u00a75[WIP]");
        par3List.add("\u00a7o\u00a77Not Completely Finished Yet");
    }
    

@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
String type) {
if (stack.itemID == Items.santaHat.itemID && ConnectionHandler.userSpecial == true) {
return "wintercraft:santaHat_2.png";
}
else if (stack.itemID == Items.santaHat.itemID && ConnectionHandler.userSpecial == false) {
return "wintercraft:santaHat_1.png";
}
return null;
}

    @SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister par1IconRegister)
    {
        this.itemIcon = par1IconRegister.registerIcon(Wintercraft.modid + ":" + this.getUnlocalizedName().substring(5));
    }
    

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

ModelBiped armorModel = null;
if(itemStack != null){
if(itemStack.getItem() instanceof ArmorSantaHat){
int type = ((ItemArmor)itemStack.getItem()).armorType;

if(type == 1 || type == 3){
    armorModel = Wintercraft.proxy.getArmorModel(0);
}else{
    armorModel = Wintercraft.proxy.getArmorModel(1);
}
if(armorModel != null){
armorModel.bipedHead.showModel = armorSlot == 0;
armorModel.isSneak = entityLiving.isSneaking();
armorModel.isRiding = entityLiving.isRiding();
armorModel.isChild = entityLiving.isChild();
armorModel.heldItemRight = entityLiving.getCurrentItemOrArmor(0) != null ? 1 :0;
if(entityLiving instanceof EntityPlayer){
armorModel.aimedBow =((EntityPlayer)entityLiving).getItemInUseDuration() > 2;
}
return armorModel;
}
}



}
return null;
}
}


Link to comment
Share on other sites

Hi

 

Yes I'm sure it's possible.

 

My first suggestion would be to try the RenderPlayerEvent.SetArmorModel event.  See RenderPlayer.setArmorModel

It looks to me like that gets called for all players (EntityClientPlayerMP and EntityOtherPlayerMP), you could use it to change the rendering model based on stored information about each player.

 

-TGG

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.

Announcements



×
×
  • Create New...

Important Information

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