Fix entity metadata recording in spawn packets

This commit is contained in:
johni0702
2015-05-29 12:06:11 +02:00
parent 2add3ed518
commit 95e2c932f0

View File

@@ -13,6 +13,7 @@ import net.minecraft.network.play.server.S0FPacketSpawnMob;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.UUID; import java.util.UUID;
public class PacketListener extends DataListener { public class PacketListener extends DataListener {
@@ -87,6 +88,7 @@ public class PacketListener extends DataListener {
lastSentPacket = pd.getTimestamp(); lastSentPacket = pd.getTimestamp();
} }
@SuppressWarnings("unchecked")
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 {
if(startTime == null) startTime = System.currentTimeMillis(); if(startTime == null) startTime = System.currentTimeMillis();
@@ -96,28 +98,26 @@ public class PacketListener extends DataListener {
if(packet instanceof S0FPacketSpawnMob) { if(packet instanceof S0FPacketSpawnMob) {
S0FPacketSpawnMob p = (S0FPacketSpawnMob) packet; S0FPacketSpawnMob p = (S0FPacketSpawnMob) packet;
p.field_149043_l = new DataWatcher(null); if (p.field_149043_l == null) {
p.field_149043_l.addObject(0, (byte)0); p.field_149043_l = new DataWatcher(null);
/* }
if(p.func_149027_c() != null) { if(p.func_149027_c() != null) {
for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>) p.func_149027_c()) { for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>) p.func_149027_c()) {
p.field_149043_l.addObject(wo.getDataValueId(), wo.getObject()); p.field_149043_l.addObject(wo.getDataValueId(), wo.getObject());
} }
} }
*/
} }
if(packet instanceof S0CPacketSpawnPlayer) { if(packet instanceof S0CPacketSpawnPlayer) {
S0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet; S0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet;
p.field_148960_i = new DataWatcher(null); if (p.field_148960_i == null) {
p.field_148960_i.addObject(0, (byte)0); p.field_148960_i = new DataWatcher(null);
/* }
if(p.func_148944_c() != null) { if(p.func_148944_c() != null) {
for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>) p.func_148944_c()) { for(DataWatcher.WatchableObject wo : (List<DataWatcher.WatchableObject>) p.func_148944_c()) {
p.field_148960_i.addObject(wo.getDataValueId(), wo.getObject()); p.field_148960_i.addObject(wo.getDataValueId(), wo.getObject());
} }
} }
*/
} }