mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
added remaining hunks from chat/title packets (#5844)
This commit is contained in:
@@ -1110,6 +1110,78 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// Spigot start
|
||||
if (this.components != null) {
|
||||
buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components));
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet;
|
||||
|
||||
public class ClientboundSetActionBarTextPacket implements Packet<ClientGamePacketListener> {
|
||||
private final Component text;
|
||||
+ public net.kyori.adventure.text.Component adventure$text; // Paper
|
||||
|
||||
public ClientboundSetActionBarTextPacket(Component message) {
|
||||
this.text = message;
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetActionBarTextPacket implements Packet<ClientGamePacke
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
+ // Paper start
|
||||
+ if (this.adventure$text != null) {
|
||||
+ buf.writeComponent(this.adventure$text);
|
||||
+ } else
|
||||
+ // Paper end
|
||||
buf.writeComponent(this.text);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet;
|
||||
|
||||
public class ClientboundSetSubtitleTextPacket implements Packet<ClientGamePacketListener> {
|
||||
private final Component text;
|
||||
+ public net.kyori.adventure.text.Component adventure$text; // Paper
|
||||
|
||||
public ClientboundSetSubtitleTextPacket(Component subtitle) {
|
||||
this.text = subtitle;
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetSubtitleTextPacket implements Packet<ClientGamePacket
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
+ // Paper start
|
||||
+ if (this.adventure$text != null) {
|
||||
+ buf.writeComponent(this.adventure$text);
|
||||
+ } else
|
||||
+ // Paper end
|
||||
buf.writeComponent(this.text);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitleTextPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitleTextPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitleTextPacket.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet;
|
||||
|
||||
public class ClientboundSetTitleTextPacket implements Packet<ClientGamePacketListener> {
|
||||
private final Component text;
|
||||
+ public net.kyori.adventure.text.Component adventure$text; // Paper
|
||||
|
||||
public ClientboundSetTitleTextPacket(Component title) {
|
||||
this.text = title;
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetTitleTextPacket implements Packet<ClientGamePacketLis
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
+ // Paper start
|
||||
+ if (this.adventure$text != null) {
|
||||
+ buf.writeComponent(this.adventure$text);
|
||||
+ } else
|
||||
+ // Paper end
|
||||
buf.writeComponent(this.text);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundTabListPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundTabListPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundTabListPacket.java
|
||||
@@ -2221,8 +2293,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendActionBar(final net.kyori.adventure.text.Component message) {
|
||||
+ final net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket packet = new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
||||
+ // packet.adventure$text = message; // TODO: kashike add fields to packet
|
||||
+ final net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket packet = new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket((net.minecraft.network.chat.Component) null);
|
||||
+ packet.adventure$text = message;
|
||||
+ this.getHandle().connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
@@ -2248,9 +2320,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private void adventure$sendPlayerListHeaderAndFooter() {
|
||||
+ final ServerGamePacketListenerImpl connection = this.getHandle().connection;
|
||||
+ if (connection == null) return;
|
||||
+ final ClientboundTabListPacket packet = new net.minecraft.network.protocol.game.ClientboundTabListPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla((this.playerListHeader == null) ? net.kyori.adventure.text.Component.empty() : this.playerListHeader), io.papermc.paper.adventure.PaperAdventure.asVanilla((this.playerListFooter == null) ? net.kyori.adventure.text.Component.empty() : this.playerListFooter));
|
||||
+ // packet.adventure$header = (this.playerListHeader == null) ? net.kyori.adventure.text.Component.empty() : this.playerListHeader; // TODO: kashike add fields to packet
|
||||
+ // packet.adventure$footer = (this.playerListFooter == null) ? net.kyori.adventure.text.Component.empty() : this.playerListFooter;
|
||||
+ final ClientboundTabListPacket packet = new ClientboundTabListPacket(null, null);
|
||||
+ packet.adventure$header = (this.playerListHeader == null) ? net.kyori.adventure.text.Component.empty() : this.playerListHeader;
|
||||
+ packet.adventure$footer = (this.playerListFooter == null) ? net.kyori.adventure.text.Component.empty() : this.playerListFooter;
|
||||
+ connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
@@ -2261,11 +2333,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (times != null) {
|
||||
+ connection.send(new ClientboundSetTitlesAnimationPacket(ticks(times.fadeIn()), ticks(times.stay()), ticks(times.fadeOut())));
|
||||
+ }
|
||||
+ final ClientboundSetSubtitleTextPacket sp = new ClientboundSetSubtitleTextPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(title.subtitle()));
|
||||
+ // sp.adventure$text = title.subtitle(); // TODO: kashike add fields to packet
|
||||
+ final ClientboundSetSubtitleTextPacket sp = new ClientboundSetSubtitleTextPacket((net.minecraft.network.chat.Component) null);
|
||||
+ sp.adventure$text = title.subtitle();
|
||||
+ connection.send(sp);
|
||||
+ final ClientboundSetTitleTextPacket tp = new ClientboundSetTitleTextPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(title.title()));
|
||||
+ // tp.adventure$text = title.title();
|
||||
+ final ClientboundSetTitleTextPacket tp = new ClientboundSetTitleTextPacket((net.minecraft.network.chat.Component) null);
|
||||
+ tp.adventure$text = title.title();
|
||||
+ connection.send(tp);
|
||||
+ }
|
||||
+
|
||||
|
Reference in New Issue
Block a user