From 63172e44680de13823c6a06256497411347f8ca9 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Wed, 3 Sep 2014 21:22:34 -0500 Subject: [PATCH] Update 1.8-proto from upstream SpigotMC Default to integer instead of hearts to match 1.7 behavior SpigotMC/Spigot@dd5ae56242494741dcd8e2d264c12036230dae27 Add a tab header / footer packet for use by plugins SpigotMC/Spigot@16a1f257e8406dff07128a8c7b54b377a7a95690 Fix an error with particle handling and add the new 'mobappearance' p... SpigotMC/Spigot@39fdf43ae7c20257c9f8aeafd9edc0109ece8a74 Use correct length when converting maps to 1.8 wire format SpigotMC/Spigot@416bbd0a32d878298fc37a8a4803ee1f3f1be7f0 Add title packet for use by plugins SpigotMC/Spigot@a1570f68e5d07bafebf76a84ae98ca2073b8e542 --- .../0180-Snapshot-protocol.patch | 135 +++++++++++++++++- 1 file changed, 130 insertions(+), 5 deletions(-) diff --git a/CraftBukkit-Patches/0180-Snapshot-protocol.patch b/CraftBukkit-Patches/0180-Snapshot-protocol.patch index 19658bbaa..561d105dc 100644 --- a/CraftBukkit-Patches/0180-Snapshot-protocol.patch +++ b/CraftBukkit-Patches/0180-Snapshot-protocol.patch @@ -1911,7 +1911,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packetdataserializer.writeByte( rows ); + packetdataserializer.writeByte( b[1] ); + packetdataserializer.writeByte( b[2] ); -+ a( packetdataserializer, Arrays.copyOfRange(b, 3, rows) ); ++ a( packetdataserializer, Arrays.copyOfRange(b, 3, b.length) ); + } else { + packetdataserializer.writeByte( 0 ); + } @@ -2722,7 +2722,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packetdataserializer.writeByte( c ); + if ( c == 0 || c == 2 ) { + packetdataserializer.a( b ); -+ packetdataserializer.a( "hearts" ); ++ packetdataserializer.a( "integer" ); + } + } + // Spigot end @@ -3218,11 +3218,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + SLIME( "slime" ), + HEART( "heart" ), + BARRIER( "barrier" ), -+ ICON_CRACK( "iconcrack", 1 ), ++ ICON_CRACK( "iconcrack", 2 ), + BLOCK_CRACK( "blockcrack", 1 ), -+ BLOCK_DUST( "blockdust", 2 ), ++ BLOCK_DUST( "blockdust", 1 ), + WATER_DROP( "droplet" ), -+ ITEM_TAKE( "take" ); ++ ITEM_TAKE( "take" ), ++ MOB_APPEARANCE( "mobappearance" ); + + public final String name; + public final int extra; @@ -3888,7 +3889,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package org.spigotmc; + ++import net.minecraft.server.ChatSerializer; +import net.minecraft.server.EnumProtocol; ++import net.minecraft.server.IChatBaseComponent; +import net.minecraft.server.Packet; +import net.minecraft.server.PacketDataSerializer; +import net.minecraft.server.PacketListener; @@ -3906,6 +3909,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + addPacket( EnumProtocol.LOGIN, true, 0x3, PacketLoginCompression.class ); + ++ addPacket( EnumProtocol.PLAY, true, 0x45, PacketTitle.class ); ++ addPacket( EnumProtocol.PLAY, true, 0x47, PacketTabHeader.class ); + addPacket( EnumProtocol.PLAY, true, 0x48, PacketPlayResourcePackSend.class ); + addPacket( EnumProtocol.PLAY, false, 0x19, PacketPlayResourcePackStatus.class ); + } catch ( NoSuchFieldException e ) @@ -4014,6 +4019,126 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + } ++ ++ public static class PacketTabHeader extends Packet ++ { ++ ++ private IChatBaseComponent header; ++ private IChatBaseComponent footer; ++ ++ public PacketTabHeader() ++ { ++ } ++ ++ public PacketTabHeader(IChatBaseComponent header, IChatBaseComponent footer) ++ { ++ this.header = header; ++ this.footer = footer; ++ } ++ ++ @Override ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ this.header = ChatSerializer.a( packetdataserializer.c( 32767 ) ); ++ this.footer = ChatSerializer.a( packetdataserializer.c( 32767 ) ); ++ } ++ ++ @Override ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.a( ChatSerializer.a( this.header ) ); ++ packetdataserializer.a( ChatSerializer.a( this.footer ) ); ++ } ++ ++ @Override ++ public void handle(PacketListener packetlistener) ++ { ++ } ++ } ++ ++ public static class PacketTitle extends Packet ++ { ++ private Action action; ++ ++ // TITLE & SUBTITLE ++ private IChatBaseComponent text; ++ ++ // TIMES ++ private int fadeIn = -1; ++ private int stay = -1; ++ private int fadeOut = -1; ++ ++ public PacketTitle() {} ++ ++ public PacketTitle(Action action) ++ { ++ this.action = action; ++ } ++ ++ public PacketTitle(Action action, IChatBaseComponent text) ++ { ++ this( action ); ++ this.text = text; ++ } ++ ++ public PacketTitle(Action action, int fadeIn, int stay, int fadeOut) ++ { ++ this( action ); ++ this.fadeIn = fadeIn; ++ this.stay = stay; ++ this.fadeOut = fadeOut; ++ } ++ ++ ++ @Override ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ this.action = Action.values()[packetdataserializer.a()]; ++ switch ( action ) ++ { ++ case TITLE: ++ case SUBTITLE: ++ this.text = ChatSerializer.a( packetdataserializer.c(32767) ); ++ break; ++ case TIMES: ++ this.fadeIn = packetdataserializer.readInt(); ++ this.stay = packetdataserializer.readInt(); ++ this.fadeOut = packetdataserializer.readInt(); ++ break; ++ } ++ } ++ ++ @Override ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.b( action.ordinal() ); ++ switch ( action ) ++ { ++ case TITLE: ++ case SUBTITLE: ++ packetdataserializer.a( ChatSerializer.a( this.text ) ); ++ break; ++ case TIMES: ++ packetdataserializer.writeInt( this.fadeIn ); ++ packetdataserializer.writeInt( this.stay ); ++ packetdataserializer.writeInt( this.fadeOut ); ++ break; ++ } ++ } ++ ++ @Override ++ public void handle(PacketListener packetlistener) ++ { ++ } ++ ++ public static enum Action { ++ TITLE, ++ SUBTITLE, ++ TIMES, ++ CLEAR, ++ RESET ++ } ++ } +} diff --git a/src/main/java/org/spigotmc/SpigotComponentReverter.java b/src/main/java/org/spigotmc/SpigotComponentReverter.java new file mode 100644