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. * 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 prefix;
private String suffix; private String suffix;
private byte friendlyFire; private byte friendlyFire;
private String unknown;
private byte unknown2;
private Set<String> players = new HashSet<>(); private Set<String> players = new HashSet<>();
public Collection<String> getPlayers() public Collection<String> getPlayers()

View File

@ -94,7 +94,7 @@ public enum Protocol
}; };
/*========================================================================*/ /*========================================================================*/
public static final int MAX_PACKET_ID = 0xFF; 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_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
public final DirectionData TO_CLIENT = new DirectionData( ProtocolConstants.Direction.TO_CLIENT ); 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[0x0A] = true; // Animation
serverboundInts[0x0B] = true; // Entity Action serverboundInts[0x0B] = true; // Entity Action
if ( version >= 7 ) if ( version >= ProtocolConstants.MINECRAFT_14_11_a )
{ {
migrateIntToVarint( clientboundInts, clientboundVarInts ); migrateIntToVarint( clientboundInts, clientboundVarInts );
migrateIntToVarint( serverboundInts, serverboundVarInts ); 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.ChannelWrapper;
import net.md_5.bungee.netty.PacketHandler; import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.PacketWrapper; 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.KeepAlive;
import net.md_5.bungee.protocol.packet.PlayerListItem; import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.ScoreboardObjective; import net.md_5.bungee.protocol.packet.ScoreboardObjective;
@ -85,7 +86,10 @@ public class DownstreamBridge extends PacketHandler
{ {
if ( !server.isObsolete() ) if ( !server.isObsolete() )
{ {
con.getEntityRewrite().rewriteClientbound( packet.buf, con.getServerEntityId(), con.getClientEntityId() ); if ( con.getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_7_6 )
{
con.getEntityRewrite().rewriteClientbound( packet.buf, con.getServerEntityId(), con.getClientEntityId() );
}
con.sendPacket( packet ); con.sendPacket( packet );
} }
} }
@ -114,7 +118,7 @@ public class DownstreamBridge extends PacketHandler
switch ( objective.getAction() ) switch ( objective.getAction() )
{ {
case 0: case 0:
serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue() ) ); serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue(), objective.getType() ) );
break; break;
case 1: case 1:
serverScoreboard.removeObjective( objective.getName() ); serverScoreboard.removeObjective( objective.getName() );
@ -177,6 +181,8 @@ public class DownstreamBridge extends PacketHandler
t.setPrefix( team.getPrefix() ); t.setPrefix( team.getPrefix() );
t.setSuffix( team.getSuffix() ); t.setSuffix( team.getSuffix() );
t.setFriendlyFire( team.getFriendlyFire() ); t.setFriendlyFire( team.getFriendlyFire() );
t.setUnknown( team.getUnknown() );
t.setUnknown2( team.getUnknown2() );
} }
if ( team.getPlayers() != null ) if ( team.getPlayers() != null )
{ {

View File

@ -383,7 +383,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
uniqueId = offlineId; 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 unsafe.sendPacket( new LoginSuccess( getUniqueId().toString(), getName() ) ); // With dashes in between
} else } else

View File

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