Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void updateAppearance(PacketBuilder packet, Player player) {
- System.out.println("Setting the appearance for " + player.getName() + ".");
- Appearance appearance = player.getAppearance();
- PacketBuilder playerProps = new PacketBuilder();
- System.out.println("Setting the gender for " + player.getName() + ".");
- playerProps.putByte((byte) appearance.getGender());
- for (int i = 0; i < 5; i++) {
- playerProps.putByte((byte) 0);
- }
- System.out.println("Setting the chest for " + player.getName() + ".");
- playerProps.putShort((short) 0x100 + appearance.getChest());
- playerProps.putByte((byte) 0);
- int[] appearanceItems = {
- 0x100 + appearance.getArms(), 0x100 + appearance.getLegs(), 0x100 + appearance.getHead(),
- 0x100 + appearance.getFeet(), 0x100 + appearance.getBeard()
- };
- System.out.println("Setting the arms, legs, head, feet and beard for " + player.getName() + ".");
- for (int i = 0; i < appearanceItems.length; i++) {
- playerProps.putShort((short) appearanceItems[i]);
- }
- int[] appearanceColor = {
- appearance.getHairColor(), appearance.getTorsoColor(), appearance.getLegColor(),
- appearance.getFeetColor(), appearance.getSkinColor()
- };
- System.out.println("Setting the colors for " + player.getName() + ".");
- for (int i = 0; i < appearanceColor.length; i++) {
- playerProps.putByte((byte) appearanceColor[i]);
- }
- int[] animation = {
- 0x328, 0x337, 0x333, 0x334, 0x335, 0x336, 0x338
- };
- System.out.println("Setting the animations for " + player.getName() + ".");
- for (int i = 0; i < animation.length; i++) {
- playerProps.putShort((short) animation[i]);
- }
- System.out.println("Setting the long name for " + player.getName() + ".");
- playerProps.putLong(NameUtility.nameToLong(player.getName()));
- System.out.println("Setting the combat level for " + player.getName() + ".");
- playerProps.putByte((byte) 3);
- System.out.println("Setting the total level for " + player.getName() + ".");
- playerProps.putShort(0);
- Packet playerPacket = playerProps.toPacket();
- System.out.println("Putting the bytes for the length and buffer for " + player.getName() + ".");
- packet.putByte((byte) playerPacket.getLength());
- packet.putBytes(playerPacket.getBuffer());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement