mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-23 18:55:22 +01:00
Update to Minecraft 1.12.1
This commit is contained in:
parent
caeb7246f0
commit
017f3a2424
@ -79,7 +79,8 @@ public enum Protocol
|
|||||||
Respawn.class,
|
Respawn.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x07 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x07 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x33 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x33 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x34 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x34 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x35 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
BossBar.class,
|
BossBar.class,
|
||||||
@ -90,7 +91,8 @@ public enum Protocol
|
|||||||
PlayerListItem.class, // PlayerInfo
|
PlayerListItem.class, // PlayerInfo
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x38 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x38 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x2D ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x2D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x2D )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x2D ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x2E )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
TabCompleteResponse.class,
|
TabCompleteResponse.class,
|
||||||
@ -102,25 +104,29 @@ public enum Protocol
|
|||||||
ScoreboardObjective.class,
|
ScoreboardObjective.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x3B ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x3B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x3F ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x3F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x41 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x41 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x42 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardScore.class,
|
ScoreboardScore.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x3C ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x3C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x42 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x42 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x44 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x44 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x45 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardDisplay.class,
|
ScoreboardDisplay.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x3D ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x3D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x38 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x38 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x3A )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x3A ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x3B )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Team.class,
|
Team.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x3E ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x3E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x41 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x41 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x43 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x43 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x44 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PluginMessage.class,
|
PluginMessage.class,
|
||||||
@ -137,45 +143,52 @@ public enum Protocol
|
|||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Title.class,
|
Title.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x45 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x45 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x47 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x47 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x48 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PlayerListHeaderFooter.class,
|
PlayerListHeaderFooter.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x47 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x47 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x48 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x48 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9_4, 0x47 ),
|
map( ProtocolConstants.MINECRAFT_1_9_4, 0x47 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x49 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x49 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x4A )
|
||||||
);
|
);
|
||||||
|
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
KeepAlive.class,
|
KeepAlive.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x0B ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x0B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x0C )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x0C ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x0B )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
Chat.class,
|
Chat.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x02 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x02 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x03 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x03 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x02 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
TabCompleteRequest.class,
|
TabCompleteRequest.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x14 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x14 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x01 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x01 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x02 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x02 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x01 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
ClientSettings.class,
|
ClientSettings.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x15 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x15 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x04 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x04 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x05 )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x05 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
PluginMessage.class,
|
PluginMessage.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_8, 0x17 ),
|
map( ProtocolConstants.MINECRAFT_1_8, 0x17 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_9, 0x09 ),
|
map( ProtocolConstants.MINECRAFT_1_9, 0x09 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x0A )
|
map( ProtocolConstants.MINECRAFT_1_12, 0x0A ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x09 )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -321,6 +334,9 @@ public enum Protocol
|
|||||||
ProtocolConstants.MINECRAFT_1_11,
|
ProtocolConstants.MINECRAFT_1_11,
|
||||||
ProtocolConstants.MINECRAFT_1_11_1
|
ProtocolConstants.MINECRAFT_1_11_1
|
||||||
) );
|
) );
|
||||||
|
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12, Arrays.asList(
|
||||||
|
ProtocolConstants.MINECRAFT_1_12_1
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -15,6 +15,7 @@ public class ProtocolConstants
|
|||||||
public static final int MINECRAFT_1_11 = 315;
|
public static final int MINECRAFT_1_11 = 315;
|
||||||
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 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",
|
||||||
@ -30,7 +31,8 @@ public class ProtocolConstants
|
|||||||
ProtocolConstants.MINECRAFT_1_10,
|
ProtocolConstants.MINECRAFT_1_10,
|
||||||
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
|
||||||
);
|
);
|
||||||
|
|
||||||
public enum Direction
|
public enum Direction
|
||||||
|
@ -44,6 +44,8 @@ public abstract class EntityMap
|
|||||||
return EntityMap_1_11.INSTANCE;
|
return EntityMap_1_11.INSTANCE;
|
||||||
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:
|
||||||
|
return EntityMap_1_12_1.INSTANCE;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,182 @@
|
|||||||
|
package net.md_5.bungee.entitymap;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
|
import net.md_5.bungee.UserConnection;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.protocol.DefinedPacket;
|
||||||
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
class EntityMap_1_12_1 extends EntityMap
|
||||||
|
{
|
||||||
|
|
||||||
|
static final EntityMap_1_12_1 INSTANCE = new EntityMap_1_12_1();
|
||||||
|
|
||||||
|
EntityMap_1_12_1()
|
||||||
|
{
|
||||||
|
addRewrite( 0x00, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Object : PacketPlayOutSpawnEntity
|
||||||
|
addRewrite( 0x01, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Experience Orb : PacketPlayOutSpawnEntityExperienceOrb
|
||||||
|
addRewrite( 0x03, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Mob : PacketPlayOutSpawnEntityLiving
|
||||||
|
addRewrite( 0x04, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Painting : PacketPlayOutSpawnEntityPainting
|
||||||
|
addRewrite( 0x05, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Player : PacketPlayOutNamedEntitySpawn
|
||||||
|
addRewrite( 0x06, ProtocolConstants.Direction.TO_CLIENT, true ); // Animation : PacketPlayOutAnimation
|
||||||
|
addRewrite( 0x08, ProtocolConstants.Direction.TO_CLIENT, true ); // Block Break Animation : PacketPlayOutBlockBreakAnimation
|
||||||
|
addRewrite( 0x1B, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Status : PacketPlayOutEntityStatus
|
||||||
|
addRewrite( 0x25, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity : PacketPlayOutEntity
|
||||||
|
addRewrite( 0x26, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Relative Move : PacketPlayOutRelEntityMove
|
||||||
|
addRewrite( 0x27, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look and Relative Move : PacketPlayOutRelEntityMoveLook
|
||||||
|
addRewrite( 0x28, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look : PacketPlayOutEntityLook
|
||||||
|
addRewrite( 0x30, ProtocolConstants.Direction.TO_CLIENT, true ); // Use bed : PacketPlayOutBed
|
||||||
|
addRewrite( 0x33, ProtocolConstants.Direction.TO_CLIENT, true ); // Remove Entity Effect : PacketPlayOutRemoveEntityEffect
|
||||||
|
addRewrite( 0x36, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Head Look : PacketPlayOutEntityHeadRotation
|
||||||
|
addRewrite( 0x39, ProtocolConstants.Direction.TO_CLIENT, true ); // Camera : PacketPlayOutCamera
|
||||||
|
addRewrite( 0x3C, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Metadata : PacketPlayOutEntityMetadata
|
||||||
|
addRewrite( 0x3D, ProtocolConstants.Direction.TO_CLIENT, false ); // Attach Entity : PacketPlayOutAttachEntity
|
||||||
|
addRewrite( 0x3E, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Velocity : PacketPlayOutEntityVelocity
|
||||||
|
addRewrite( 0x3F, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Equipment : PacketPlayOutEntityEquipment
|
||||||
|
addRewrite( 0x43, ProtocolConstants.Direction.TO_CLIENT, true ); // Set Passengers : PacketPlayOutMount
|
||||||
|
addRewrite( 0x4B, ProtocolConstants.Direction.TO_CLIENT, true ); // Collect Item : PacketPlayOutCollect
|
||||||
|
addRewrite( 0x4C, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Teleport : PacketPlayOutEntityTeleport
|
||||||
|
addRewrite( 0x4E, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Properties : PacketPlayOutUpdateAttributes
|
||||||
|
addRewrite( 0x4F, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Effect : PacketPlayOutEntityEffect
|
||||||
|
|
||||||
|
addRewrite( 0x0B, ProtocolConstants.Direction.TO_SERVER, true ); // Use Entity : PacketPlayInUseEntity
|
||||||
|
addRewrite( 0x15, ProtocolConstants.Direction.TO_SERVER, true ); // Entity Action : PacketPlayInEntityAction
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
|
||||||
|
public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
|
||||||
|
{
|
||||||
|
super.rewriteClientbound( packet, oldId, newId );
|
||||||
|
|
||||||
|
// Special cases
|
||||||
|
int readerIndex = packet.readerIndex();
|
||||||
|
int packetId = DefinedPacket.readVarInt( packet );
|
||||||
|
int packetIdLength = packet.readerIndex() - readerIndex;
|
||||||
|
int jumpIndex = packet.readerIndex();
|
||||||
|
switch ( packetId )
|
||||||
|
{
|
||||||
|
case 0x3D /* Attach Entity : PacketPlayOutAttachEntity */:
|
||||||
|
rewriteInt( packet, oldId, newId, readerIndex + packetIdLength + 4 );
|
||||||
|
break;
|
||||||
|
case 0x4B /* Collect Item : PacketPlayOutCollect */:
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
break;
|
||||||
|
case 0x43 /* Attach Entity : PacketPlayOutMount */:
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
jumpIndex = packet.readerIndex();
|
||||||
|
// Fall through on purpose to int array of IDs
|
||||||
|
case 0x32 /* Destroy Entities : PacketPlayOutEntityDestroy */:
|
||||||
|
int count = DefinedPacket.readVarInt( packet );
|
||||||
|
int[] ids = new int[ count ];
|
||||||
|
for ( int i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
ids[i] = DefinedPacket.readVarInt( packet );
|
||||||
|
}
|
||||||
|
packet.readerIndex( jumpIndex );
|
||||||
|
packet.writerIndex( jumpIndex );
|
||||||
|
DefinedPacket.writeVarInt( count, packet );
|
||||||
|
for ( int id : ids )
|
||||||
|
{
|
||||||
|
if ( id == oldId )
|
||||||
|
{
|
||||||
|
id = newId;
|
||||||
|
} else if ( id == newId )
|
||||||
|
{
|
||||||
|
id = oldId;
|
||||||
|
}
|
||||||
|
DefinedPacket.writeVarInt( id, packet );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */:
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
DefinedPacket.readUUID( packet );
|
||||||
|
int type = packet.readUnsignedByte();
|
||||||
|
|
||||||
|
if ( type == 60 || type == 90 || type == 91 )
|
||||||
|
{
|
||||||
|
if ( type == 60 || type == 91 )
|
||||||
|
{
|
||||||
|
oldId = oldId + 1;
|
||||||
|
newId = newId + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet.skipBytes( 26 ); // double, double, double, byte, byte
|
||||||
|
int position = packet.readerIndex();
|
||||||
|
int readId = packet.readInt();
|
||||||
|
if ( readId == oldId )
|
||||||
|
{
|
||||||
|
packet.setInt( position, newId );
|
||||||
|
} else if ( readId == newId )
|
||||||
|
{
|
||||||
|
packet.setInt( position, oldId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x05 /* Spawn Player : PacketPlayOutNamedEntitySpawn */:
|
||||||
|
DefinedPacket.readVarInt( packet ); // Entity ID
|
||||||
|
int idLength = packet.readerIndex() - readerIndex - packetIdLength;
|
||||||
|
UUID uuid = DefinedPacket.readUUID( packet );
|
||||||
|
ProxiedPlayer player;
|
||||||
|
if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null )
|
||||||
|
{
|
||||||
|
int previous = packet.writerIndex();
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
||||||
|
DefinedPacket.writeUUID( player.getUniqueId(), packet );
|
||||||
|
packet.writerIndex( previous );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x2D /* Combat Event : PacketPlayOutCombatEvent */:
|
||||||
|
int event = packet.readUnsignedByte();
|
||||||
|
if ( event == 1 /* End Combat*/ )
|
||||||
|
{
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
rewriteInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
} else if ( event == 2 /* Entity Dead */ )
|
||||||
|
{
|
||||||
|
int position = packet.readerIndex();
|
||||||
|
rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
packet.readerIndex( position );
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
rewriteInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x3C /* EntityMetadata : PacketPlayOutEntityMetadata */:
|
||||||
|
DefinedPacket.readVarInt( packet ); // Entity ID
|
||||||
|
rewriteMetaVarInt( packet, oldId, newId, 7 ); // fireworks (et al)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
|
||||||
|
{
|
||||||
|
super.rewriteServerbound( packet, oldId, newId );
|
||||||
|
// Special cases
|
||||||
|
int readerIndex = packet.readerIndex();
|
||||||
|
int packetId = DefinedPacket.readVarInt( packet );
|
||||||
|
int packetIdLength = packet.readerIndex() - readerIndex;
|
||||||
|
|
||||||
|
if ( packetId == 0x1E /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() )
|
||||||
|
{
|
||||||
|
UUID uuid = DefinedPacket.readUUID( packet );
|
||||||
|
ProxiedPlayer player;
|
||||||
|
if ( ( player = BungeeCord.getInstance().getPlayer( uuid ) ) != null )
|
||||||
|
{
|
||||||
|
int previous = packet.writerIndex();
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
packet.writerIndex( readerIndex + packetIdLength );
|
||||||
|
DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet );
|
||||||
|
packet.writerIndex( previous );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user