RuneHive-Game
Loading...
Searching...
No Matches
SendPlayerUpdate.java
Go to the documentation of this file.
1package com.runehive.net.packet.out;
2
3import com.runehive.game.Animation;
4import com.runehive.game.Graphic;
5import com.runehive.game.world.World;
6import com.runehive.game.world.entity.combat.hit.Hit;
7import com.runehive.game.world.entity.combat.hit.Hitsplat;
8import com.runehive.game.world.entity.mob.Direction;
9import com.runehive.game.world.entity.mob.Mob;
10import com.runehive.game.world.entity.mob.UpdateFlag;
11import com.runehive.game.world.entity.mob.Viewport;
12import com.runehive.game.world.entity.mob.player.ForceMovement;
13import com.runehive.game.world.entity.mob.player.Player;
14import com.runehive.game.world.entity.mob.player.appearance.Gender;
15import com.runehive.game.world.entity.mob.player.relations.ChatMessage;
16import com.runehive.game.world.items.Item;
17import com.runehive.game.world.items.containers.equipment.Equipment;
18import com.runehive.game.world.items.containers.equipment.EquipmentType;
19import com.runehive.game.world.position.Position;
20import com.runehive.net.codec.AccessType;
21import com.runehive.net.codec.ByteModification;
22import com.runehive.net.codec.ByteOrder;
23import com.runehive.net.packet.OutgoingPacket;
24import com.runehive.net.packet.PacketBuilder;
25import com.runehive.net.packet.PacketType;
26import com.runehive.util.Utility;
27import org.apache.logging.log4j.LogManager;
28import org.apache.logging.log4j.Logger;
29
30import java.util.Collection;
31import java.util.EnumSet;
32import java.util.Iterator;
33
34public final class SendPlayerUpdate extends OutgoingPacket {
35
36 private static final Logger logger = LogManager.getLogger(SendPlayerUpdate.class);
37
39 super(81, PacketType.VAR_SHORT);
40 }
41
42 @Override
43 public boolean encode(Player player) {
44 if (player.regionChange) {
45 player.send(new SendMapRegion());
46 }
47
48 final PacketBuilder blockBuf = PacketBuilder.alloc();
49 try {
50 builder.initializeAccess(AccessType.BIT);
51
52 updateMovement(player, builder);
53
54 if (player.isUpdateRequired()) {
55 updatePlayer(blockBuf, player, player, UpdateState.UPDATE_SELF);
56 }
57
58 final Collection<Player> localPlayers = World.getRegions().getLocalPlayers(player);
59
60 builder.writeBits(8, player.viewport.getPlayersInViewport().size());
61
62 for (Iterator<Player> itr = player.viewport.getPlayersInViewport().iterator(); itr.hasNext();) {
63 Player other = itr.next();
64
65 if (player.viewport.shouldRemove(other)) {
66 builder.writeBit(true);
67 builder.writeBits(2, 3);
68 itr.remove();
69 } else {
70 updateMovement(other, builder);
71
72 if (other.isUpdateRequired()) {
73 updatePlayer(blockBuf, player, other, UpdateState.UPDATE_LOCAL);
74 }
75 }
76
77 }
78
79 int added = 0;
80
81 for (Player localPlayer : localPlayers) {
82
83 if (player.viewport.getPlayersInViewport().size() >= Viewport.CAPACITY || added >= Viewport.ADD_THRESHOLD) {
84 break;
85 }
86
87 if (player.viewport.add(localPlayer)) {
88 added++;
89 addNewPlayer(builder, player, localPlayer);
90 updatePlayer(blockBuf, player, localPlayer, UpdateState.ADD_LOCAL);
91 }
92
93 }
94
95 if (blockBuf.content().readableBytes() > 0) {
96 builder.writeBits(11, 2047);
97 builder.initializeAccess(AccessType.BYTE);
98 builder.writeBuffer(blockBuf.content());
99 } else {
100 builder.initializeAccess(AccessType.BYTE);
101 }
102 } catch (Exception ex) {
103 logger.error(String.format("error updating player=%s", player), ex);
104 } finally {
105 blockBuf.release();
106 }
107 return true;
108 }
109
110 private static void addNewPlayer(PacketBuilder packetBuf, Player player, Player other) {
111 packetBuf.writeBits(11, other.getIndex())
112 .writeBit(true) // isUpdateRequired
113 .writeBit(true) // discardWalkingQueue
114 .writeBits(5, other.getY() - player.getY())
115 .writeBits(5, other.getX() - player.getX());
116 }
117
118 private static void updatePlayer(PacketBuilder blockBuf, Player player, Player other, UpdateState state) {
119 if (!other.isUpdateRequired()) {
120 return;
121 }
122
123 int mask = 0;
124
125 final EnumSet<UpdateFlag> updateFlags = other.updateFlags;
126 for (UpdateFlag flag : UpdateFlag.playerOrder) {
127 if (updateFlags.contains(flag) && flag.canApply(player, other, state)) {
128 mask |= flag.playerMask;
129 }
130 }
131
132 if (mask >= 0x100) {
133 mask |= 0x40;
134 blockBuf.writeByte(mask & 0xFF);
135 blockBuf.writeByte(mask >> 8);
136 } else {
137 blockBuf.writeByte(mask);
138 }
139
140 // TODO replace the checks.
141 /* for (UpdateFlag flag : UpdateFlag.playerOrder) {
142 if (UpdateFlag.containsPlayer(mask, flag)) {
143
144 }
145 }*/
146
148 appendForceMovementMask(player, other, blockBuf);
149 }
150
152 appendGraphicMask(other, blockBuf);
153 }
154
156 appendAnimationMask(other, blockBuf);
157 }
158
160 appendForceChatMask(other, blockBuf);
161 }
162
164 appendChatMask(blockBuf, other);
165 }
166
168 appendFaceEntityMask(other, blockBuf);
169 }
170
172 appendAppearanceMask(other, blockBuf);
173 }
174
176 appendFaceCoordinteMask(other, blockBuf);
177 }
178
180 appendHitMask(other, blockBuf);
181 }
182
184 appendSecondHitMask(other, blockBuf);
185 }
186
187 }
188
189 private static void appendForceMovementMask(Player player, Player other, PacketBuilder blockBuf) {
190 final ForceMovement fm = other.getForceMovement();
191
192 final Position lastPosition = player.lastPosition;
193 final Position otherPosition = other.getPosition();
194 final int startX = otherPosition.getLocalX(lastPosition);
195 final int startY = otherPosition.getLocalY(lastPosition);
196
197 final Position end = fm.getEnd();
198 final int endX = end.getX();
199 final int endY = end.getY();
200
201 blockBuf.writeByte(startX, ByteModification.SUB)
203 .writeByte(startX + endX, ByteModification.SUB)
204 .writeByte(startY + endY, ByteModification.SUB)
208 }
209
210 private static void appendForceChatMask(Player other, PacketBuilder blockBuf) {
211 blockBuf.writeString(other.forceChat);
212 }
213
214 private static void appendFaceEntityMask(Player other, PacketBuilder blockBuf) {
215 Mob mob = other.interactingWith;
216 if (mob != null) {
217 int index = mob.getIndex();
218 if (mob.isPlayer()) {
219 index += -32768;
220 }
221 blockBuf.writeShort(index, ByteOrder.LE);
222 } else {
223 blockBuf.writeShort(65535, ByteOrder.LE);
224 }
225 }
226
227 private static void appendFaceCoordinteMask(Player other, PacketBuilder blockBuf) {
228 Position loc = other.facePosition;
229
230 if (loc == null) {
231 Position currentPos = other.getPosition();
232 Direction currentDir = other.movement.lastDirection;
233 blockBuf.writeShort(((currentPos.getX() + currentDir.getDirectionX()) << 1), ByteModification.ADD, ByteOrder.LE)
234 .writeShort(((currentPos.getY() + currentDir.getDirectionY()) << 1) + 1, ByteOrder.LE);
235 } else {
236 blockBuf.writeShort((loc.getX() << 1) + 1, ByteModification.ADD, ByteOrder.LE)
237 .writeShort((loc.getY() << 1) + 1, ByteOrder.LE);
238 }
239 }
240
241 private static void appendAnimationMask(Player other, PacketBuilder maskBuf) {
242 Animation anim = other.getAnimation().orElse(Animation.RESET);
243 maskBuf.writeShort(anim.getId(), ByteOrder.LE);
244 maskBuf.writeByte(anim.getDelay(), ByteModification.NEG);
245 }
246
247 private static void appendGraphicMask(Player other, PacketBuilder blockBuf) {
248 Graphic graphic = other.getGraphic().orElse(Graphic.RESET);
249 blockBuf.writeShort(graphic.getId(), ByteOrder.LE)
250 .writeInt(graphic.getDelay() | graphic.getHeight());
251 }
252
253 private static void appendChatMask(PacketBuilder blockBuf, Player other) {
254 final ChatMessage message = other.getChatMessage().orElse(ChatMessage.create("Cabbage"));
255
256 final byte[] encoded = message.getEncoded();
257 blockBuf.writeShort(((message.getColor().getCode() & 0xFF) << 8) | (message.getEffect().getCode() & 0xFF), ByteOrder.LE)
258 .writeByte(other.right.getCrown())
259 .writeByte(encoded.length, ByteModification.NEG)
260 .writeBytesReverse(encoded);
261 }
262
263 private static void appendAppearanceMask(Player other, PacketBuilder blockBuf) {
264 final PacketBuilder tempBuf = PacketBuilder.alloc();
265 final var overrides = other.overrides;
266 try {
267 tempBuf.writeByte(other.appearance.getGender().ordinal())
268 .writeByte(other.headIcon)
270 .writeByte(other.valueIcon);
271
272 if (other.id != -1) {
273 tempBuf.writeShort(-1);
274 tempBuf.writeShort(other.id);
275 } else {
276 Item helm = other.equipment.get(Equipment.HEAD_SLOT);
277 if (overrides.hasOverride(Equipment.HEAD_SLOT)) {
278 tempBuf.writeShort(0x200 + overrides.get(Equipment.HELM_SLOT).getId());
279 } else if (helm != null && helm.getId() > 1) {
280 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.HELM_SLOT).getId());
281 } else {
282 tempBuf.writeByte(0);
283 }
284
285 if (overrides.hasOverride(Equipment.CAPE_SLOT)) {
286 tempBuf.writeShort(0x200 + overrides.get(Equipment.CAPE_SLOT).getId());
287 } else if (other.equipment.get(Equipment.CAPE_SLOT) != null) {
288 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.CAPE_SLOT).getId());
289 } else {
290 tempBuf.writeByte(0);
291 }
292
293 if (overrides.hasOverride(Equipment.AMULET_SLOT)) {
294 tempBuf.writeShort(0x200 + overrides.get(Equipment.AMULET_SLOT).getId());
295 } else if (other.equipment.get(Equipment.AMULET_SLOT) != null) {
296 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.AMULET_SLOT).getId());
297 } else {
298 tempBuf.writeByte(0);
299 }
300
301 if (overrides.hasOverride(Equipment.WEAPON_SLOT)) {
302 tempBuf.writeShort(0x200 + overrides.get(Equipment.WEAPON_SLOT).getId());
303 } else if (other.equipment.get(Equipment.WEAPON_SLOT) != null) {
304 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.WEAPON_SLOT).getId());
305 } else {
306 tempBuf.writeByte(0);
307 }
308
309 Item torso = other.equipment.get(Equipment.CHEST_SLOT);
310 if (overrides.hasOverride(Equipment.CHEST_SLOT)) {
311 tempBuf.writeShort(0x200 + overrides.get(Equipment.CHEST_SLOT).getId());
312 } else if (torso != null && torso.getId() > 1) {
313 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.CHEST_SLOT).getId());
314 } else {
315 tempBuf.writeShort(0x100 + other.appearance.getTorso());
316 }
317
318 if (overrides.hasOverride(Equipment.SHIELD_SLOT)) {
319 tempBuf.writeShort(0x200 + overrides.get(Equipment.SHIELD_SLOT).getId());
320 } else if (other.equipment.get(Equipment.SHIELD_SLOT) != null) {
321 if (overrides.hasOverride(Equipment.WEAPON_SLOT) && overrides.get(Equipment.WEAPON_SLOT).isTwoHanded()) {
322 tempBuf.writeByte(0);
323 } else {
324 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.SHIELD_SLOT).getId());
325 }
326 } else {
327 tempBuf.writeByte(0);
328 }
329
330 if (torso != null && torso.getId() > 1 && torso.getEquipmentType().equals(EquipmentType.BODY) ||
331 overrides.hasOverride(Equipment.CHEST_SLOT) && overrides.get(Equipment.CHEST_SLOT).getEquipmentType().equals(EquipmentType.BODY)) {
332 tempBuf.writeByte(0);
333 } else {
334 tempBuf.writeShort(0x100 + other.appearance.getArms());
335 }
336
337 if (overrides.hasOverride(Equipment.LEGS_SLOT)) {
338 tempBuf.writeShort(0x200 + overrides.get(Equipment.LEGS_SLOT).getId());
339 } else if (other.equipment.get(Equipment.LEGS_SLOT) != null) {
340 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.LEGS_SLOT).getId());
341 } else {
342 tempBuf.writeShort(0x100 + other.appearance.getLegs());
343 }
344
345 boolean head = true;
346 boolean beard = true;
347
348 if (helm != null && helm.getId() > 1) {
350 head = type.equals(EquipmentType.MASK) || type.equals(EquipmentType.HAT);
351 beard = type.equals(EquipmentType.FACE) || type.equals(EquipmentType.HAT);
352 }
353
354 if (overrides.hasOverride(Equipment.HEAD_SLOT)) {
355 final var override = overrides.get(Equipment.HEAD_SLOT).getEquipmentType();
356 head = override.equals(EquipmentType.MASK) || override.equals(EquipmentType.HAT);
357 beard = override.equals(EquipmentType.FACE) || override.equals(EquipmentType.HAT);
358 }
359
360 if (head) {
361 tempBuf.writeShort(0x100 + other.appearance.getHead());
362 } else {
363 tempBuf.writeByte(0);
364 }
365
366 if (overrides.hasOverride(Equipment.HANDS_SLOT)) {
367 tempBuf.writeShort(0x200 + overrides.get(Equipment.HANDS_SLOT).getId());
368 } else if (other.equipment.get(Equipment.HANDS_SLOT) != null) {
369 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.HANDS_SLOT).getId());
370 } else {
371 tempBuf.writeShort(0x100 + other.appearance.getHands());
372 }
373
374 if (overrides.hasOverride(Equipment.FEET_SLOT)) {
375 tempBuf.writeShort(0x200 + overrides.get(Equipment.FEET_SLOT).getId());
376 } else if (other.equipment.get(Equipment.FEET_SLOT) != null) {
377 tempBuf.writeShort(0x200 + other.equipment.get(Equipment.FEET_SLOT).getId());
378 } else {
379 tempBuf.writeShort(0x100 + other.appearance.getFeet());
380 }
381
382 if (other.appearance.getGender().equals(Gender.MALE)) {
383 if (beard) {
384 tempBuf.writeShort(0x100 + other.appearance.getBeard());
385 } else {
386 tempBuf.writeByte(0);
387 }
388 } else {
389 tempBuf.writeByte(0);
390 }
391 }
392
393 tempBuf
406 .writeLong(Utility.hash(other.getName()))
409 .writeString(other.clanChannel == null ? "" : other.clanChannel.getOwner())
410 .writeString(other.clanTag)
412 .writeLong(Double.doubleToLongBits(other.skills.getCombatLevel()))
413 .writeByte(other.right.getCrown())
414 .writeShort(0);
415 blockBuf.writeByte(tempBuf.content().writerIndex(), ByteModification.NEG);
416 blockBuf.writeBytes(tempBuf.content());
417 } finally {
418 tempBuf.release();
419 }
420 }
421
422 private static void appendHitMask(final Player player, final PacketBuilder blockBuf) {
423 Hit hit = player.firstHit;
424
425 boolean multipleHits = hit.getMultipleHits() != null;
426 blockBuf.writeByte(multipleHits ? 1 : 0);
427
428
429 int max = player.getMaximumHealth() >= 500 ? 200 : 100;
430 int health = player.getCurrentHealth() * max / player.getMaximumHealth();
431 if (health > max) health = max;
432
433 if(multipleHits) {
434 blockBuf.writeByte(hit.getMultipleHits().length);
435
436 for(int index = 0; index < hit.getMultipleHits().length; index++) {
437 Hit currentHit = hit.getMultipleHits()[index];
438
439 int id = currentHit.getHitsplat().getId();
440
441 if (currentHit.getHitsplat() == Hitsplat.NORMAL && currentHit.getDamage() > 0) {
442 id++;
443 }
444
445 blockBuf.writeByte(currentHit.getDamage());
446 blockBuf.writeByte(id, ByteModification.ADD);
447 blockBuf.writeByte(currentHit.getHitIcon().getId());
448 }
449
450 } else {
451
452 int id = hit.getHitsplat().getId();
453
454 if (hit.getHitsplat() == Hitsplat.NORMAL && hit.getDamage() > 0) {
455 id++;
456 }
457
458 blockBuf.writeByte(hit.getDamage());
459 blockBuf.writeByte(id, ByteModification.ADD);
460 blockBuf.writeByte(hit.getHitIcon().getId());
461 }
462
463 blockBuf.writeByte(health);
464 blockBuf.writeByte(max, ByteModification.NEG);
465 }
466
467 private static void appendSecondHitMask(final Player player, final PacketBuilder blockBuf) {
468 Hit hit = player.secondHit;
469
470 boolean multipleHits = hit.getMultipleHits() != null;
471 blockBuf.writeByte(multipleHits ? 1 : 0);
472
473 int max = player.getMaximumHealth() >= 500 ? 200 : 100;
474 int health = player.getCurrentHealth() * max / player.getMaximumHealth();
475 if (health > max) health = max;
476
477 if(multipleHits) {
478 blockBuf.writeByte(hit.getMultipleHits().length);
479
480 for(int index = 0; index < hit.getMultipleHits().length; index++) {
481 Hit currentHit = hit.getMultipleHits()[index];
482
483 int id = currentHit.getHitsplat().getId();
484
485 if (currentHit.getHitsplat() == Hitsplat.NORMAL && currentHit.getDamage() > 0) {
486 id++;
487 }
488
489 blockBuf.writeByte(currentHit.getDamage());
490 blockBuf.writeByte(id, ByteModification.ADD);
491 blockBuf.writeByte(currentHit.getHitIcon().getId());
492 }
493 } else {
494 int id = hit.getHitsplat().getId();
495
496 if (hit.getHitsplat() == Hitsplat.NORMAL && hit.getDamage() > 0) {
497 id++;
498 }
499
500 blockBuf.writeByte(hit.getDamage());
501 blockBuf.writeByte(id, ByteModification.SUB);
502 blockBuf.writeByte(hit.getHitIcon().getId());
503 }
504
505 blockBuf.writeByte(health);
506 blockBuf.writeByte(max, ByteModification.NEG);
507 }
508
509 private static void updateMovement(Player player, PacketBuilder packetBuf) {
510 final boolean teleported = player.positionChange || player.teleportRegion;
511 final boolean updateRequired = player.isUpdateRequired();
512 if (teleported) {
513 packetBuf.writeBit(true)
514 .writeBits(2, 3)
515 .writeBits(2, player.getHeight())
516 .writeBits(1, player.regionChange ? 0 : 1)
517 .writeBit(updateRequired)
518 .writeBits(7, player.getPosition().getLocalY(player.lastPosition))
519 .writeBits(7, player.getPosition().getLocalX(player.lastPosition));
520 } else if (player.movement.getRunningDirection() != -1) {
521 packetBuf.writeBit(true)
522 .writeBits(2, 2)
525 .writeBit(player.isUpdateRequired());
526 } else if (player.movement.getWalkingDirection() != -1) {
527 packetBuf.writeBit(true)
528 .writeBits(2, 1)
530 .writeBit(player.isUpdateRequired());
531 } else {
532 if (updateRequired) {
533 packetBuf.writeBit(true)
534 .writeBits(2, 0);
535 } else {
536 packetBuf.writeBit(false);
537 }
538 }
539 }
540
546
547}
SkullHeadIconType getHeadIconType()
Gets the skull icon.
Class that models a single animation used by an entity.
int getId()
Gets the animation id.
static final Animation RESET
int getDelay()
Gets the animation delay.
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
static final Graphic RESET
Definition Graphic.java:17
int getDelay()
Gets the delay of this graphic.
Definition Graphic.java:167
int getId()
Gets the id of this graphic.
Definition Graphic.java:185
int getHeight()
Gets the height of this graphic.
Definition Graphic.java:176
Represents the game world.
Definition World.java:46
static RegionManager getRegions()
Definition World.java:552
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
int getDamage()
Gets the damage amount.
Definition Hit.java:121
Hitsplat getHitsplat()
Gets the damage type.
Definition Hit.java:130
HitIcon getHitIcon()
Gets the hit icon.
Definition Hit.java:139
Handles the mob class.
Definition Mob.java:66
Optional< Graphic > getGraphic()
Definition Mob.java:712
final EnumSet< UpdateFlag > updateFlags
Definition Mob.java:94
boolean isUpdateRequired()
Checks if mob requires an update.
Definition Mob.java:543
Optional< Animation > getAnimation()
Definition Mob.java:708
final boolean isPlayer()
Check if an entity is a player.
Definition Mob.java:564
Represents a viewport in which a Player can see.
Definition Viewport.java:15
boolean add(Mob other)
Adds a Mob to this viewport.
Definition Viewport.java:52
boolean shouldRemove(Mob other)
Determines if a Mob should be removed from this viewport.
Definition Viewport.java:93
static final int ADD_THRESHOLD
The amount of entities that can be added to this viewport in a single tick.
Definition Viewport.java:18
static final int CAPACITY
The amount of entities that can be visible at all at once 255 players and 255 npcs.
Definition Viewport.java:21
List< Player > getPlayersInViewport()
The collection of players in this viewport.
Direction lastDirection
The last direction the mob walked in.
Definition Movement.java:45
This class represents a character controlled by a player.
Definition Player.java:125
String getName()
Gets the name of this entity.
Definition Player.java:774
Represents a chat message that can be displayed over an entities head.
int getCombatLevel()
Gets the mob's combat level.
The container class that represents an item that can be interacted with.
Definition Item.java:21
final int getId()
Gets the identification of this item.
Definition Item.java:324
EquipmentType getEquipmentType()
Definition Item.java:441
final Item get(int index)
Gets the Item located on index.
The container that manages the equipment for a player.
static final int HEAD_SLOT
Equipment slot constants.
Represents a single tile on the game world.
Definition Position.java:14
int getY()
Gets the absolute y coordinate.
Definition Position.java:46
int getX()
Gets the absolute x coordinate.
Definition Position.java:41
int getLocalY()
Gets the local y coordinate relative to this region.
Definition Position.java:61
int getLocalX()
Gets the local x coordinate relative to this region.
Definition Position.java:56
List< Player > getLocalPlayers(Mob mob)
Gets the local players around an entity.
OutgoingPacket(int opcode, int capacity)
The implementation that functions as a dynamic buffer wrapper backed by a ByteBuf that is used for re...
PacketBuilder writeBytesReverse(byte[] data)
PacketBuilder writeBytes(byte[] from, int size)
PacketBuilder writeLong(long value)
PacketBuilder writeBit(boolean flag)
PacketBuilder writeBits(int amount, int value)
static PacketBuilder alloc(int initialCapacity, int maxCapacity)
PacketBuilder writeString(String string)
static void appendGraphicMask(Player other, PacketBuilder blockBuf)
static void appendFaceCoordinteMask(Player other, PacketBuilder blockBuf)
static void updateMovement(Player player, PacketBuilder packetBuf)
static void appendFaceEntityMask(Player other, PacketBuilder blockBuf)
static void appendAppearanceMask(Player other, PacketBuilder blockBuf)
static void appendSecondHitMask(final Player player, final PacketBuilder blockBuf)
static void appendChatMask(PacketBuilder blockBuf, Player other)
static void appendForceMovementMask(Player player, Player other, PacketBuilder blockBuf)
static void appendForceChatMask(Player other, PacketBuilder blockBuf)
static void addNewPlayer(PacketBuilder packetBuf, Player player, Player other)
static void appendAnimationMask(Player other, PacketBuilder maskBuf)
static void updatePlayer(PacketBuilder blockBuf, Player player, Player other, UpdateState state)
static void appendHitMask(final Player player, final PacketBuilder blockBuf)
Handles miscellaneous methods.
Definition Utility.java:27
static long hash(String input)
Definition Utility.java:217
final int getId()
Gets the identification for this hit type.
Definition HitIcon.java:45
final int getId()
Gets the identification for this hit type.
Definition Hitsplat.java:34
Represents the enumerated directions an entity can walk or face.
boolean canApply(Player player, Player other, SendPlayerUpdate.UpdateState state)
static boolean containsPlayer(int masks, UpdateFlag flag)
static String getCrown(Player player)
Gets the crown display.
Represents a gender for a player character.
Definition Gender.java:8
The enumerated types of a players equipped item slots.
Represents the different forms data can be written in.
BIT
The type that denotes bits can be written as bytes.
BYTE
the type that denotes bytes can be written directly.
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.
Represents the order in which bytes are written.
Definition ByteOrder.java:8
LE
Represents Little-endian.
Represents a type of packet.
VAR_SHORT
A variable packet where the size is indicated by a short.