RuneHive-Game
Loading...
Searching...
No Matches
SendObjectAnimation.java
Go to the documentation of this file.
1package com.runehive.net.packet.out;
2
3import com.runehive.net.codec.ByteModification;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.object.GameObject;
6import com.runehive.net.packet.OutgoingPacket;
7
8public class SendObjectAnimation extends OutgoingPacket {
9
10 private final int animation;
11 private final GameObject object;
12
14 super(160, 4);
15 this.animation = animation;
16 this.object = object;
17 }
18
19 @Override
20 public boolean encode(Player player) {
21 player.send(new SendCoordinate(object.getPosition()));
22 builder.writeByte(0, ByteModification.SUB)
23 .writeByte((object.getObjectType().getId() << 2) + (object.getDirection().getId() & 3), ByteModification.SUB)
24 .writeShort(animation, ByteModification.ADD);
25 return true;
26 }
27
28}
This class represents a character controlled by a player.
Definition Player.java:125
OutgoingPacket(int opcode, int capacity)
SendObjectAnimation(int animation, GameObject object)
Represents RuneScape's custom value types.
SUB
Subtracts the value from 128 when written, adds 128 to the rarity when read.
ADD
Adds 128 to the value when written, subtracts 128 from the rarity when read.