Skip to content

Commit ceacce7

Browse files
author
Matsv
committed
Change the formatting and check if ClientWorld is already in the map
1 parent e26c34d commit ceacce7

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/Protocol1_9To1_10.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ protected void registerPackets() {
4040
}
4141

4242
public void init(UserConnection user) {
43-
user.put(new ClientWorld(user));
43+
// Register ClientWorld
44+
if (!user.has(ClientWorld.class))
45+
user.put(new ClientWorld(user));
4446

4547
// Register EntityTracker if it doesn't exist yet.
4648
if (!user.has(EntityTracker.class))

src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/packets/BlockItemPackets.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ public void handle(PacketWrapper wrapper) throws Exception {
124124
});
125125

126126
// Click window packet
127-
protocol.registerIncoming(State.PLAY, 0x07, 0x07, new
128-
129-
PacketRemapper() {
127+
protocol.registerIncoming(State.PLAY, 0x07, 0x07, new PacketRemapper() {
130128
@Override
131129
public void registerMap() {
132130
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@@ -145,13 +143,10 @@ public void handle(PacketWrapper wrapper) throws Exception {
145143
});
146144
}
147145
}
148-
149146
);
150147

151148
// Creative Inventory Action
152-
protocol.registerIncoming(State.PLAY, 0x18, 0x18, new
153-
154-
PacketRemapper() {
149+
protocol.registerIncoming(State.PLAY, 0x18, 0x18, new PacketRemapper() {
155150
@Override
156151
public void registerMap() {
157152
map(Type.SHORT); // 0 - Slot
@@ -166,15 +161,12 @@ public void handle(PacketWrapper wrapper) throws Exception {
166161
});
167162
}
168163
}
169-
170164
);
171165

172166
/* Block packets */
173167

174168
// Chunk packet
175-
protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new
176-
177-
PacketRemapper() {
169+
protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
178170
@Override
179171
public void registerMap() {
180172
handler(new PacketHandler() {
@@ -206,13 +198,10 @@ public void handle(PacketWrapper wrapper) throws Exception {
206198
});
207199
}
208200
}
209-
210201
);
211202

212203
// Block Change Packet
213-
protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new
214-
215-
PacketRemapper() {
204+
protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
216205
@Override
217206
public void registerMap() {
218207
map(Type.POSITION); // 0 - Block Position
@@ -227,13 +216,10 @@ public void handle(PacketWrapper wrapper) throws Exception {
227216
});
228217
}
229218
}
230-
231219
);
232220

233221
// Multi Block Change Packet
234-
protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new
235-
236-
PacketRemapper() {
222+
protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new PacketRemapper() {
237223
@Override
238224
public void registerMap() {
239225
map(Type.INT); // 0 - Chunk X
@@ -255,7 +241,6 @@ public void handle(PacketWrapper wrapper) throws Exception {
255241
});
256242
}
257243
}
258-
259244
);
260245

261246
/* Register Metadata */

0 commit comments

Comments
 (0)