Change the formatting and check if ClientWorld is already in the map

This commit is contained in:
Matsv 2016-08-08 18:02:18 +02:00
parent e26c34daf5
commit ceacce741a
2 changed files with 8 additions and 21 deletions

View File

@ -40,6 +40,8 @@ public class Protocol1_9To1_10 extends BackwardsProtocol {
} }
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class))
user.put(new ClientWorld(user)); user.put(new ClientWorld(user));
// Register EntityTracker if it doesn't exist yet. // Register EntityTracker if it doesn't exist yet.

View File

@ -124,9 +124,7 @@ public class BlockItemPackets extends BlockItemRewriter<Protocol1_9To1_10> {
}); });
// Click window packet // Click window packet
protocol.registerIncoming(State.PLAY, 0x07, 0x07, new protocol.registerIncoming(State.PLAY, 0x07, 0x07, new PacketRemapper() {
PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -145,13 +143,10 @@ public class BlockItemPackets extends BlockItemRewriter<Protocol1_9To1_10> {
}); });
} }
} }
); );
// Creative Inventory Action // Creative Inventory Action
protocol.registerIncoming(State.PLAY, 0x18, 0x18, new protocol.registerIncoming(State.PLAY, 0x18, 0x18, new PacketRemapper() {
PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.SHORT); // 0 - Slot map(Type.SHORT); // 0 - Slot
@ -166,15 +161,12 @@ public class BlockItemPackets extends BlockItemRewriter<Protocol1_9To1_10> {
}); });
} }
} }
); );
/* Block packets */ /* Block packets */
// Chunk packet // Chunk packet
protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(new PacketHandler() { handler(new PacketHandler() {
@ -206,13 +198,10 @@ public class BlockItemPackets extends BlockItemRewriter<Protocol1_9To1_10> {
}); });
} }
} }
); );
// Block Change Packet // Block Change Packet
protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.POSITION); // 0 - Block Position map(Type.POSITION); // 0 - Block Position
@ -227,13 +216,10 @@ public class BlockItemPackets extends BlockItemRewriter<Protocol1_9To1_10> {
}); });
} }
} }
); );
// Multi Block Change Packet // Multi Block Change Packet
protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new PacketRemapper() {
PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.INT); // 0 - Chunk X map(Type.INT); // 0 - Chunk X
@ -255,7 +241,6 @@ public class BlockItemPackets extends BlockItemRewriter<Protocol1_9To1_10> {
}); });
} }
} }
); );
/* Register Metadata */ /* Register Metadata */