]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/common/messages/PayloadReader.java
1186bc5eda1b08d2f4f92b43730f859b4b3e9b8b
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / common / messages / PayloadReader.java
1 package com.irtimaled.bbor.common.messages;
2
3 import com.irtimaled.bbor.common.models.Coords;
4 import com.irtimaled.bbor.common.models.DimensionId;
5 import net.minecraft.network.PacketBuffer;
6 import net.minecraft.util.ResourceLocation;
7
8 public class PayloadReader {
9     private final PacketBuffer buffer;
10
11     public PayloadReader(PacketBuffer buffer) {
12         this.buffer = buffer;
13     }
14
15     long readLong() {
16         return buffer.readLong();
17     }
18
19     int readInt() {
20         return buffer.readInt();
21     }
22
23     int readVarInt() {
24         return buffer.readVarInt();
25     }
26
27     boolean isReadable() {
28         return buffer.isReadable();
29     }
30
31     boolean isReadable(int count) {
32         return buffer.isReadable(count);
33     }
34
35     char readChar() {
36         return buffer.readChar();
37     }
38
39     Coords readCoords() {
40         int x = readVarInt();
41         int y = readVarInt();
42         int z = readVarInt();
43         return new Coords(x, y, z);
44     }
45
46     DimensionId readDimensionId() {
47         return DimensionId.from(buffer.readResourceLocation());
48     }
49 }