Update to Minecraft 1.12.2

This commit is contained in:
md_5 2017-09-18 20:00:00 +10:00
parent 3db9fb1b69
commit 0eaabdf5ca
5 changed files with 17 additions and 5 deletions

View File

@ -337,6 +337,9 @@ public enum Protocol
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12, Arrays.asList( linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12, Arrays.asList(
ProtocolConstants.MINECRAFT_1_12_1 ProtocolConstants.MINECRAFT_1_12_1
) ); ) );
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12_1, Arrays.asList(
ProtocolConstants.MINECRAFT_1_12_2
) );
} }
@Getter @Getter

View File

@ -16,6 +16,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_11_1 = 316; public static final int MINECRAFT_1_11_1 = 316;
public static final int MINECRAFT_1_12 = 335; public static final int MINECRAFT_1_12 = 335;
public static final int MINECRAFT_1_12_1 = 338; public static final int MINECRAFT_1_12_1 = 338;
public static final int MINECRAFT_1_12_2 = 340;
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList( public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
"1.8.x", "1.8.x",
"1.9.x", "1.9.x",
@ -32,7 +33,8 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_11, ProtocolConstants.MINECRAFT_1_11,
ProtocolConstants.MINECRAFT_1_11_1, ProtocolConstants.MINECRAFT_1_11_1,
ProtocolConstants.MINECRAFT_1_12, ProtocolConstants.MINECRAFT_1_12,
ProtocolConstants.MINECRAFT_1_12_1 ProtocolConstants.MINECRAFT_1_12_1,
ProtocolConstants.MINECRAFT_1_12_2
); );
public enum Direction public enum Direction

View File

@ -16,18 +16,24 @@ import net.md_5.bungee.protocol.ProtocolConstants;
public class KeepAlive extends DefinedPacket public class KeepAlive extends DefinedPacket
{ {
private int randomId; private long randomId;
@Override @Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{ {
randomId = readVarInt( buf ); randomId = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_12_2 ) ? buf.readLong() : readVarInt( buf );
} }
@Override @Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{ {
writeVarInt( randomId, buf ); if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_12_2 )
{
buf.writeLong( randomId );
} else
{
writeVarInt( (int) randomId, buf );
}
} }
@Override @Override

View File

@ -91,7 +91,7 @@ public final class UserConnection implements ProxiedPlayer
/*========================================================================*/ /*========================================================================*/
@Getter @Getter
@Setter @Setter
private int sentPingId; private long sentPingId;
@Getter @Getter
@Setter @Setter
private long sentPingTime; private long sentPingTime;

View File

@ -45,6 +45,7 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_12: case ProtocolConstants.MINECRAFT_1_12:
return EntityMap_1_12.INSTANCE; return EntityMap_1_12.INSTANCE;
case ProtocolConstants.MINECRAFT_1_12_1: case ProtocolConstants.MINECRAFT_1_12_1:
case ProtocolConstants.MINECRAFT_1_12_2:
return EntityMap_1_12_1.INSTANCE; return EntityMap_1_12_1.INSTANCE;
} }
throw new RuntimeException( "Version " + version + " has no entity map" ); throw new RuntimeException( "Version " + version + " has no entity map" );