Enable 14w11 support, changing servers is a bit iffy though due to EntityMap not being complete.

This commit is contained in:
md_5 2014-04-16 11:01:41 +10:00
parent 3715756be7
commit 5a638f2290
7 changed files with 23 additions and 7 deletions

View File

@ -16,5 +16,9 @@ public class Objective
/**
* Value of the objective.
*/
private final String value; // displayName
private final String value;
/**
* Type; integer or hearts
*/
private final String type;
}

View File

@ -17,6 +17,8 @@ public class Team
private String prefix;
private String suffix;
private byte friendlyFire;
private String unknown;
private byte unknown2;
private Set<String> players = new HashSet<>();
public Collection<String> getPlayers()

View File

@ -94,7 +94,7 @@ public enum Protocol
};
/*========================================================================*/
public static final int MAX_PACKET_ID = 0xFF;
public static List<Integer> supportedVersions = Arrays.asList( ProtocolConstants.MINECRAFT_1_7_2, ProtocolConstants.MINECRAFT_1_7_6 );
public static List<Integer> supportedVersions = Arrays.asList( ProtocolConstants.MINECRAFT_1_7_2, ProtocolConstants.MINECRAFT_1_7_6, ProtocolConstants.MINECRAFT_14_11_a );
/*========================================================================*/
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
public final DirectionData TO_CLIENT = new DirectionData( ProtocolConstants.Direction.TO_CLIENT );

View File

@ -54,7 +54,7 @@ public class EntityMap
serverboundInts[0x0A] = true; // Animation
serverboundInts[0x0B] = true; // Entity Action
if ( version >= 7 )
if ( version >= ProtocolConstants.MINECRAFT_14_11_a )
{
migrateIntToVarint( clientboundInts, clientboundVarInts );
migrateIntToVarint( serverboundInts, serverboundVarInts );

View File

@ -24,6 +24,7 @@ import net.md_5.bungee.chat.ComponentSerializer;
import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.KeepAlive;
import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.ScoreboardObjective;
@ -84,8 +85,11 @@ public class DownstreamBridge extends PacketHandler
public void handle(PacketWrapper packet) throws Exception
{
if ( !server.isObsolete() )
{
if ( con.getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_7_6 )
{
con.getEntityRewrite().rewriteClientbound( packet.buf, con.getServerEntityId(), con.getClientEntityId() );
}
con.sendPacket( packet );
}
}
@ -114,7 +118,7 @@ public class DownstreamBridge extends PacketHandler
switch ( objective.getAction() )
{
case 0:
serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue() ) );
serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue(), objective.getType() ) );
break;
case 1:
serverScoreboard.removeObjective( objective.getName() );
@ -177,6 +181,8 @@ public class DownstreamBridge extends PacketHandler
t.setPrefix( team.getPrefix() );
t.setSuffix( team.getSuffix() );
t.setFriendlyFire( team.getFriendlyFire() );
t.setUnknown( team.getUnknown() );
t.setUnknown2( team.getUnknown2() );
}
if ( team.getPlayers() != null )
{

View File

@ -383,7 +383,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
uniqueId = offlineId;
}
if ( getVersion() == ProtocolConstants.MINECRAFT_1_7_6 )
if ( getVersion() >= ProtocolConstants.MINECRAFT_1_7_6 )
{
unsafe.sendPacket( new LoginSuccess( getUniqueId().toString(), getName() ) ); // With dashes in between
} else

View File

@ -20,6 +20,7 @@ import net.md_5.bungee.protocol.packet.ClientSettings;
import net.md_5.bungee.protocol.packet.PluginMessage;
import java.util.ArrayList;
import java.util.List;
import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.TabCompleteResponse;
public class UpstreamBridge extends PacketHandler
@ -61,8 +62,11 @@ public class UpstreamBridge extends PacketHandler
@Override
public void handle(PacketWrapper packet) throws Exception
{
if ( con.getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_7_6 )
{
con.getEntityRewrite().rewriteServerbound( packet.buf, con.getClientEntityId(), con.getServerEntityId() );
}
if ( con.getServer() != null )
{
con.getServer().getCh().write( packet );