mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
Update ComponentRewriter
This commit is contained in:
parent
9f380a7598
commit
4473f863c6
@ -28,23 +28,6 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
// Packets using components:
|
||||
// ping (status)
|
||||
// disconnect (play and login)
|
||||
// chat
|
||||
// bossbar
|
||||
// open window
|
||||
// combat event
|
||||
// title
|
||||
// tablist
|
||||
// teams
|
||||
// scoreboard
|
||||
// player info
|
||||
// map data
|
||||
// declare commands
|
||||
// advancements
|
||||
// update sign
|
||||
|
||||
/**
|
||||
* Handles json chat components, containing methods to override certain parts of the handling.
|
||||
* Also contains methods to register a few of the packets using components.
|
||||
@ -63,7 +46,13 @@ public class ComponentRewriter {
|
||||
this.protocol = null;
|
||||
}
|
||||
|
||||
public void registerChatMessage(ClientboundPacketType packetType) {
|
||||
/**
|
||||
* Processes components at the beginning of the packet.
|
||||
* Used for packets that have components as their very first value, so no special pre-reading is necessary.
|
||||
*
|
||||
* @param packetType clientbound packet type
|
||||
*/
|
||||
public void registerComponentPacket(ClientboundPacketType packetType) {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -72,6 +61,10 @@ public class ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerChatMessage(ClientboundPacketType packetType) {
|
||||
registerComponentPacket(packetType);
|
||||
}
|
||||
|
||||
public void registerBossBar(ClientboundPacketType packetType) {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
@ -88,6 +81,9 @@ public class ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles sub 1.17 combat event components.
|
||||
*/
|
||||
public void registerCombatEvent(ClientboundPacketType packetType) {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
@ -103,6 +99,9 @@ public class ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles sub 1.17 title components.
|
||||
*/
|
||||
public void registerTitle(ClientboundPacketType packetType) {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user