Update 1.8-proto from upstream SpigotMC

Default to integer instead of hearts to match 1.7 behavior SpigotMC/Spigot@dd5ae56242
Add a tab header / footer packet for use by plugins SpigotMC/Spigot@16a1f257e8
Fix an error with particle handling and add the new 'mobappearance' p... SpigotMC/Spigot@39fdf43ae7
Use correct length when converting maps to 1.8 wire format SpigotMC/Spigot@416bbd0a32
Add title packet for use by plugins SpigotMC/Spigot@a1570f68e5
This commit is contained in:
Zach Brown 2014-09-03 21:22:34 -05:00
parent 8afe9168c7
commit 63172e4468

View File

@ -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