Player class (client sided): Declare this with the others at the bottom of the class: public int modHeadIcon;
then still in Player.java, find public void updatePlayer(
right underneath that there should be
headIcon = stream.readByte();
skullIcon = stream.readByte();
add underneath them:
modHeadIcon = stream.readByte();
Save and close your Player.java.
Then go to your client class find:
void updateEntitiesscroll down abit until you find:
int l = 30;
Player player = (Player) obj;
if (player.headIcon >= 0 || player.skullIcon >= 0)
change the:if (player.headIcon >= 0 || player.skullIcon >= 0)
to: if (player.headIcon >= 0 || player.skullIcon >= 0 || player.modHeadIcon >= 0)
Then in the same place, at:
if (player.headIcon < 7 && player.headIcon != -1) {
headIcons[player.headIcon].drawSprite(
spriteDrawX - 12, spriteDrawY - l);
l += 18;
}under it add:
if (player.modHeadIcon < 6 && player.modHeadIcon != -1) {
modIcons[player.modHeadIcon].drawSprite(spriteDrawX - 8, spriteDrawY - l);
l += 18;
}
For people who get this error:
client.java:1730: cannot find symbol
symbol : method drawSprite(int,int)
location: class Background
modIcons[player.
modHeadIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
^
Note: client.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Tryck ned valfri tangent f?r att forts?tta...
Use this code:
if (player.modHeadIcon < 6 && player.modHeadIcon != -1) {
modIcons[player.modHeadIcon].drawBackground(spriteDrawX - 8, spriteDrawY - l);
l += 18;
}
Now were done client sided. Lets move to server.
Go to your Player class (server sided!) find:
void appendPlayerAppearance(
there will be playerProps.writeByte(headIcon);
playerProps.writeByte(skullIcon);add underneath:playerProps.wriiteByte(modHeadIcon);It might not be the same, it looks this for shard though, just copy the others but withmodHeadIconAlse: public int modHeadIcon = -1;
with the others, in the playerclass
Then head into your client class(server sided!) Go to your initialize method and add: switch(getPrivileges()) {
case 3:
modHeadIcon = 2;
break;
case 2:
modHeadIcon = 1;
break;
case 1:
modHeadIcon = 0;
break;
}
If you're using pi:
switch(c.playerRights) {
case 3:
modHeadIcon = 2;
break;
case 2:
modHeadIcon = 1;
break;
case 1:
modHeadIcon = 0;
break;
}
Wallah. we're done.