-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5441c10
commit d729d18
Showing
9 changed files
with
231 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...main/java/btw/lowercase/viasnapshot/protocol/v15w31bto15w31a/Protocol15w31b_To15w31a.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package btw.lowercase.viasnapshot.protocol.v15w31bto15w31a; | ||
|
||
import btw.lowercase.viasnapshot.protocol.v15w31ato1_8.packet.ClientboundPackets15w31a; | ||
import btw.lowercase.viasnapshot.protocol.v15w31ato1_8.packet.ServerboundPackets15w31a; | ||
import btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.packet.ClientboundPackets15w31b; | ||
import btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.packet.ServerboundPackets15w31b; | ||
import btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.rewriter.PacketRewriter15w31b; | ||
import com.viaversion.viaversion.api.protocol.AbstractProtocol; | ||
|
||
public class Protocol15w31b_To15w31a extends AbstractProtocol<ClientboundPackets15w31a, ClientboundPackets15w31b, ServerboundPackets15w31a, ServerboundPackets15w31b> { | ||
public Protocol15w31b_To15w31a() { | ||
super(ClientboundPackets15w31a.class, ClientboundPackets15w31b.class, ServerboundPackets15w31a.class, ServerboundPackets15w31b.class); | ||
} | ||
|
||
@Override | ||
protected void registerPackets() { | ||
PacketRewriter15w31b.register(this); | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
...a/btw/lowercase/viasnapshot/protocol/v15w31bto15w31a/packet/ClientboundPackets15w31b.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.packet; | ||
|
||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; | ||
|
||
public enum ClientboundPackets15w31b implements ClientboundPacketType { | ||
KEEP_ALIVE, | ||
LOGIN, | ||
CHAT, | ||
SET_TIME, | ||
SET_EQUIPPED_ITEM, | ||
SET_DEFAULT_SPAWN_POSITION, | ||
SET_HEALTH, | ||
RESPAWN, | ||
PLAYER_POSITION, | ||
SET_CARRIED_ITEM, | ||
PLAYER_SLEEP, | ||
ANIMATE, | ||
ADD_PLAYER, | ||
TAKE_ITEM_ENTITY, | ||
ADD_ENTITY, | ||
ADD_MOB, | ||
ADD_PAINTING, | ||
ADD_EXPERIENCE_ORB, | ||
SET_ENTITY_MOTION, | ||
REMOVE_ENTITIES, | ||
MOVE_ENTITY, | ||
MOVE_ENTITY_POS, | ||
MOVE_ENTITY_ROT, | ||
MOVE_ENTITY_POS_ROT, | ||
TELEPORT_ENTITY, | ||
ROTATE_HEAD, | ||
ENTITY_EVENT, | ||
SET_ENTITY_LINK, | ||
SET_ENTITY_DATA, | ||
UPDATE_MOB_EFFECT, | ||
REMOVE_MOB_EFFECT, | ||
SET_EXPERIENCE, | ||
UPDATE_ATTRIBUTES, | ||
LEVEL_CHUNK, | ||
CHUNK_BLOCKS_UPDATE, | ||
BLOCK_UPDATE, | ||
BLOCK_EVENT, | ||
BLOCK_DESTRUCTION, | ||
MAP_BULK_CHUNK, | ||
EXPLODE, | ||
LEVEL_EVENT, | ||
CUSTOM_SOUND, | ||
LEVEL_PARTICLES, | ||
GAME_EVENT, | ||
ADD_GLOBAL_ENTITY, | ||
OPEN_SCREEN, | ||
CONTAINER_CLOSE, | ||
CONTAINER_SET_SLOT, | ||
CONTAINER_SET_CONTENT, | ||
CONTAINER_SET_DATA, | ||
CONTAINER_ACK, | ||
UPDATE_SIGN, | ||
MAP_ITEM_DATA, | ||
BLOCK_ENTITY_DATA, | ||
OPEN_SIGN_EDITOR, | ||
AWARD_STATS, | ||
PLAYER_INFO, | ||
PLAYER_ABILITIES, | ||
COMMAND_SUGGESTIONS, | ||
SET_OBJECTIVE, | ||
SET_SCORE, | ||
SET_DISPLAY_OBJECTIVE, | ||
SET_PLAYER_TEAM, | ||
CUSTOM_PAYLOAD, | ||
DISCONNECT, | ||
CHANGE_DIFFICULTY, | ||
PLAYER_COMBAT, | ||
SET_CAMERA, | ||
SET_BORDER, | ||
SET_TITLES, | ||
SET_COMPRESSION, | ||
TAB_LIST, | ||
RESOURCE_PACK, | ||
BOSS_BAR; | ||
|
||
ClientboundPackets15w31b() { | ||
} | ||
|
||
public int getId() { | ||
return this.ordinal(); | ||
} | ||
|
||
public String getName() { | ||
return this.name(); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...a/btw/lowercase/viasnapshot/protocol/v15w31bto15w31a/packet/ServerboundPackets15w31b.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.packet; | ||
|
||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; | ||
|
||
public enum ServerboundPackets15w31b implements ServerboundPacketType { | ||
KEEP_ALIVE, | ||
CHAT, | ||
INTERACT, | ||
MOVE_PLAYER_STATUS_ONLY, | ||
MOVE_PLAYER_POS, | ||
MOVE_PLAYER_ROT, | ||
MOVE_PLAYER_POS_ROT, | ||
PLAYER_ACTION, | ||
USE_ITEM, | ||
USE_ITEM_ON, | ||
SET_CARRIED_ITEM, | ||
SWING, | ||
PLAYER_COMMAND, | ||
PLAYER_INPUT, | ||
CONTAINER_CLOSE, | ||
CONTAINER_CLICK, | ||
CONTAINER_ACK, | ||
SET_CREATIVE_MODE_SLOT, | ||
CONTAINER_BUTTON_CLICK, | ||
SIGN_UPDATE, | ||
PLAYER_ABILITIES, | ||
COMMAND_SUGGESTION, | ||
CLIENT_INFORMATION, | ||
CLIENT_COMMAND, | ||
CUSTOM_PAYLOAD, | ||
TELEPORT_TO_ENTITY, | ||
RESOURCE_PACK; | ||
|
||
ServerboundPackets15w31b() { | ||
} | ||
|
||
public int getId() { | ||
return this.ordinal(); | ||
} | ||
|
||
public String getName() { | ||
return this.name(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ava/btw/lowercase/viasnapshot/protocol/v15w31bto15w31a/rewriter/PacketRewriter15w31b.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.rewriter; | ||
|
||
import btw.lowercase.viasnapshot.protocol.v15w31ato1_8.packet.ClientboundPackets15w31a; | ||
import btw.lowercase.viasnapshot.protocol.v15w31bto15w31a.Protocol15w31b_To15w31a; | ||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; | ||
import com.viaversion.viaversion.api.type.Types; | ||
import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; | ||
|
||
// https://wiki.vg/index.php?title=Pre-release_protocol&direction=prev&oldid=6751 | ||
public class PacketRewriter15w31b { | ||
public static void register(final Protocol15w31b_To15w31a protocol) { | ||
// Player List Item | ||
protocol.registerClientbound(ClientboundPackets15w31a.PLAYER_INFO, new PacketHandlers() { | ||
public void register() { | ||
map(Types.VAR_INT); // Action | ||
map(Types.VAR_INT); // Count | ||
handler((wrapper) -> { | ||
final int action = wrapper.get(Types.VAR_INT, 0); | ||
final int count = wrapper.get(Types.VAR_INT, 1); | ||
for (int i = 0; i < count; ++i) { | ||
wrapper.passthrough(Types.UUID); // UUID | ||
if (action != 0) { | ||
if (action != 1 && action != 2) { | ||
// Update Display Name | ||
if (action == 3) { | ||
String displayName = wrapper.read(Types.OPTIONAL_STRING); | ||
wrapper.write(Types.OPTIONAL_COMPONENT, displayName != null ? Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, displayName) : null); | ||
} | ||
} else { | ||
// ? | ||
wrapper.passthrough(Types.VAR_INT); | ||
} | ||
} else { | ||
// Add Player | ||
wrapper.passthrough(Types.STRING); // Name | ||
|
||
final int properties = wrapper.passthrough(Types.VAR_INT); // Number of properties | ||
for (int j = 0; j < properties; ++j) { | ||
wrapper.passthrough(Types.STRING); | ||
wrapper.passthrough(Types.STRING); | ||
wrapper.passthrough(Types.OPTIONAL_STRING); | ||
} | ||
|
||
wrapper.passthrough(Types.VAR_INT); | ||
wrapper.passthrough(Types.VAR_INT); | ||
|
||
String displayName = wrapper.read(Types.OPTIONAL_STRING); | ||
wrapper.write(Types.OPTIONAL_COMPONENT, displayName != null ? Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, displayName) : null); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
|
||
protocol.cancelClientbound(ClientboundPackets15w31a.UPDATE_ENTITY_NBT); // TODO: now bossbar | ||
} | ||
} |