void HandleDefineModel() { int start = reader.index - 1; byte id = reader.ReadUInt8(); CustomModel model = null; switch (reader.ReadUInt8()) { case 0: model = new CustomModel(game); model.ReadSetupPacket(reader); game.ModelCache.CustomModels[id] = model; break; case 1: model = game.ModelCache.CustomModels[id]; if (model != null) { model.ReadMetadataPacket(reader); } break; case 2: model = game.ModelCache.CustomModels[id]; if (model != null) { model.ReadDefinePartPacket(reader); } break; case 3: model = game.ModelCache.CustomModels[id]; if (model != null) { model.ReadRotationPacket(reader); } break; } int total = packetSizes[(byte)Opcode.CpeDefineModel]; reader.Skip(total - (reader.index - start)); }