Undid previous change in PacketListener.
This commit is contained in:
@@ -96,6 +96,19 @@ public class PacketListener extends DataListener {
|
|||||||
lastSentPacket = pd.getTimestamp();
|
lastSentPacket = pd.getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Field spawnMobDataWatcher, spawnPlayerDataWatcher;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
spawnMobDataWatcher = S0FPacketSpawnMob.class.getDeclaredField(MCPNames.field("field_149043_l"));
|
||||||
|
spawnMobDataWatcher.setAccessible(true);
|
||||||
|
|
||||||
|
spawnPlayerDataWatcher = S0CPacketSpawnPlayer.class.getDeclaredField(MCPNames.field("field_148960_i"));
|
||||||
|
spawnPlayerDataWatcher.setAccessible(true);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private PacketData getPacketData(ChannelHandlerContext ctx, Packet packet) throws IOException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
|
private PacketData getPacketData(ChannelHandlerContext ctx, Packet packet) throws IOException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
|
||||||
|
|
||||||
@@ -107,6 +120,22 @@ public class PacketListener extends DataListener {
|
|||||||
|
|
||||||
ByteBuf bb = Unpooled.buffer();
|
ByteBuf bb = Unpooled.buffer();
|
||||||
|
|
||||||
|
if(packet instanceof S0FPacketSpawnMob) {
|
||||||
|
DataWatcher l = (DataWatcher)spawnMobDataWatcher.get(packet);
|
||||||
|
DataWatcher dw = new DataWatcher(null);
|
||||||
|
if(l == null) {
|
||||||
|
spawnMobDataWatcher.set(packet, dw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(packet instanceof S0CPacketSpawnPlayer) {
|
||||||
|
DataWatcher l = (DataWatcher)spawnPlayerDataWatcher.get(packet);
|
||||||
|
DataWatcher dw = new DataWatcher(null);
|
||||||
|
if(l == null) {
|
||||||
|
spawnPlayerDataWatcher.set(packet, dw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
packetSerializer.encode(ctx, packet, bb);
|
packetSerializer.encode(ctx, packet, bb);
|
||||||
|
|
||||||
bb.readerIndex(0);
|
bb.readerIndex(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user